summaryrefslogtreecommitdiff
path: root/x11-clocks/tclock/files/patch-aa
blob: c5b69a5e111824fb6f3fec8447a7140baa1e000a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
*** tclock.c	Sun Feb  7 20:24:51 1999
--- work/tclock.c	Sun Feb  7 20:34:52 1999
***************
*** 22,28 ****
--- 22,31 ----
   */
  
  #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
  #include <math.h>
+ #include <time.h>
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
  #include <X11/Xos.h>
***************
*** 51,57 ****
  int     screen_number;
  Window  rootWindow, mainWindow;
  int     ShapeEventNumber, ShapeErrorNumber;
! long    clock;
  struct tm lastTimes, times;
  Pixmap  border, clip;
  GC      clearGC, drawGC;
--- 54,60 ----
  int     screen_number;
  Window  rootWindow, mainWindow;
  int     ShapeEventNumber, ShapeErrorNumber;
! time_t  lclock;
  struct tm lastTimes, times;
  Pixmap  border, clip;
  GC      clearGC, drawGC;
***************
*** 212,218 ****
    XShapeCombineMask(display, mainWindow, ShapeBounding, 0, 0, border, ShapeSet);
    XShapeCombineMask(display, mainWindow, ShapeClip, 0, 0, clip, ShapeSet);
  
!   XFlush(display, 1);
  
    /* This call to XPending ensures that if the window gets closed, we die */
    XPending(display);
--- 215,221 ----
    XShapeCombineMask(display, mainWindow, ShapeBounding, 0, 0, border, ShapeSet);
    XShapeCombineMask(display, mainWindow, ShapeClip, 0, 0, clip, ShapeSet);
  
!   XFlush(display);
  
    /* This call to XPending ensures that if the window gets closed, we die */
    XPending(display);
***************
*** 233,243 ****
  int
  sigalrm()
  {
!   clock = time(0);
!   times = *localtime(&clock);
    times.tm_hour = times.tm_hour * 5 + times.tm_min / 12;
    reshape();
!   signal(SIGALRM, sigalrm);		/* For SysV lusers */
  }
  
  unsigned long
--- 236,246 ----
  int
  sigalrm()
  {
!   lclock = time(0);
!   times = *localtime(&lclock);
    times.tm_hour = times.tm_hour * 5 + times.tm_min / 12;
    reshape();
!   signal(SIGALRM, (void *)sigalrm);		/* For SysV lusers */
  }
  
  unsigned long
***************
*** 330,336 ****
    display = XOpenDisplay(displayName);
    if(display == 0)
    {
!     fprintf("Couldn't open display %s\n", displayName);
      exit(-1);
    }
  
--- 333,339 ----
    display = XOpenDisplay(displayName);
    if(display == 0)
    {
!     fprintf(stderr, "Couldn't open display %s\n", displayName);
      exit(-1);
    }
  
***************
*** 347,353 ****
    if(access(fn, R_OK) == 0)
      XrmMergeDatabases(XrmGetFileDatabase(fn), &db);
  
!   if(getenv("XENVIRONMENT") && access(getenv("XENVIRONMENT")) == 0)
      XrmMergeDatabases(XrmGetFileDatabase(getenv("XENVIRONMENT")), &db);
  
    XrmMergeDatabases(cmdDB, &db);
--- 350,356 ----
    if(access(fn, R_OK) == 0)
      XrmMergeDatabases(XrmGetFileDatabase(fn), &db);
  
!   if(getenv("XENVIRONMENT") && access(getenv("XENVIRONMENT"), R_OK) == 0)
      XrmMergeDatabases(XrmGetFileDatabase(getenv("XENVIRONMENT")), &db);
  
    XrmMergeDatabases(cmdDB, &db);
***************
*** 410,416 ****
    XMapRaised(display, mainWindow);
    XFlush(display);
  
!   signal(SIGALRM, sigalrm);
    new.it_interval.tv_sec = 1;
    new.it_value.tv_sec = 1;
    new.it_interval.tv_usec = 0;
--- 413,419 ----
    XMapRaised(display, mainWindow);
    XFlush(display);
  
!   signal(SIGALRM, (void *)sigalrm);
    new.it_interval.tv_sec = 1;
    new.it_value.tv_sec = 1;
    new.it_interval.tv_usec = 0;
***************
*** 420,423 ****
    for(;;)
      sigpause(0);
  }
- 
--- 423,425 ----