View | Details | Raw Unified | Return to bug 16028
Collapse All | Expand All

(-)wmclock-1.0.12.2-orig/wmclock.c (-9 / +30 lines)
Lines 20-25 Link Here
20
 * with the software or the use or other dealings in the software.
20
 * with the software or the use or other dealings in the software.
21
 */
21
 */
22
22
23
#include <sys/select.h>
23
#include <sys/types.h>
24
#include <sys/types.h>
24
#include <sys/wait.h>
25
#include <sys/wait.h>
25
#include <sys/time.h>
26
#include <sys/time.h>
Lines 141-147 Link Here
141
Display    *dpy;
142
Display    *dpy;
142
Window     rootWindow;
143
Window     rootWindow;
143
int        screen;
144
int        screen;
144
/* int        xFd; */
145
int        xFd;
146
fd_set     xFdSet;
145
int        displayDepth;
147
int        displayDepth;
146
XSizeHints sizeHints;
148
XSizeHints sizeHints;
147
XWMHints   wmHints;
149
XWMHints   wmHints;
Lines 801-806 Link Here
801
   XTextProperty wmName;
803
   XTextProperty wmName;
802
   XClassHint    classHint;
804
   XClassHint    classHint;
803
   Pixmap        shapeMask;
805
   Pixmap        shapeMask;
806
   struct timeval nextEvent;
804
   
807
   
805
   /* Parse command line options */
808
   /* Parse command line options */
806
   progName = extractProgName(argv[0]);
809
   progName = extractProgName(argv[0]);
Lines 842-848 Link Here
842
   screen       = DefaultScreen(dpy);
845
   screen       = DefaultScreen(dpy);
843
   rootWindow   = RootWindow(dpy, screen);
846
   rootWindow   = RootWindow(dpy, screen);
844
   displayDepth = DefaultDepth(dpy, screen);
847
   displayDepth = DefaultDepth(dpy, screen);
845
   /* xFd          = XConnectionNumber(dpy); */
848
   xFd          = XConnectionNumber(dpy);
846
   
849
   
847
   /* Icon Daten nach XImage konvertieren */
850
   /* Icon Daten nach XImage konvertieren */
848
   GetXpms();
851
   GetXpms();
Lines 1042-1055 Link Here
1042
	   poll((struct poll *) 0, (size_t) 0, 50);	/* 5/100 sec */
1045
	   poll((struct poll *) 0, (size_t) 0, 50);	/* 5/100 sec */
1043
	}
1046
	}
1044
#else
1047
#else
1045
       if (enableYearDisplay)
1048
       //We compute the date of next event, in order to avoid polling
1046
	{
1049
       if (enableBlinking)
1047
	   usleep(200000L);	/* 1/5 sec */
1050
	 {
1048
	}
1051
	   gettimeofday(&nextEvent,NULL);
1052
	   nextEvent.tv_sec = 0;
1053
	   nextEvent.tv_usec = 1000000-nextEvent.tv_usec;
1054
	 }
1049
       else
1055
       else
1050
	{
1056
	 {
1051
	   usleep(50000L);	/* 5/100 sec */
1057
	   if (enableYearDisplay)
1052
	}
1058
	     {
1059
	       nextEvent.tv_sec = 86400-actualTime%86400;
1060
	       nextEvent.tv_usec = 0;
1061
	     }
1062
	   else
1063
	     {
1064
	       nextEvent.tv_sec = 60-actualTime%60;
1065
	       nextEvent.tv_usec = 0;
1066
	     }
1067
	 }
1068
//       printf("xFd %d\n", xFd);
1069
       FD_ZERO(&xFdSet);
1070
       FD_SET(xFd,&xFdSet);
1071
//       printf("debut select %d\n", nextEvent.tv_sec);
1072
       select(FD_SETSIZE,&xFdSet,NULL,NULL,&nextEvent);
1073
//       printf("fin select\n");
1053
#endif
1074
#endif
1054
    }
1075
    }
1055
   return(0);
1076
   return(0);

Return to bug 16028