diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-08-01 13:22:35 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-08-01 13:22:35 -0700 |
commit | d990122dafcde5d22c8f1aa40e8f9dc213f79e17 (patch) | |
tree | dbedd2ec1907b10852f6a1b0377ddcb4903671a6 /xmag.c | |
parent | eb12c1f539cebbd7481711d1dc97e3e29b594389 (diff) |
Make fix for Sun bug 6359959 more portable - use nanosleep, poll or select
Diffstat (limited to 'xmag.c')
-rw-r--r-- | xmag.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -28,6 +28,7 @@ from The Open Group. */ /* $XFree86: xmag.c,v 1.13 2003/05/27 22:27:07 tsi Exp $ */ +#include "config.h" #include <stdlib.h> /* for exit() and abs() */ #include <stdio.h> @@ -50,7 +51,6 @@ from The Open Group. #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) #endif -#include <poll.h> @@ -61,8 +61,26 @@ from The Open Group. * 20 milliseconds - enough for screen refresh - not too long to annoy users * since we hold a server grab during this time */ -#define HLSLEEP poll(NULL, 0, 20) - +#define HLSLEEPINTERVAL 20 /* milliseconds */ + +#ifdef HAVE_NANOSLEEP +#include <time.h> +#define HLSLEEP do { \ + struct timespec sleeptime = { 0 , HLSLEEPINTERVAL * 1000000 } ; \ + nanosleep(&sleeptime, NULL); \ + } while(0) +#elif defined(HAVE_POLL) +#include <poll.h> +#define HLSLEEP poll(NULL, 0, HLSLEEPINTERVAL) +#elif defined(HAVE_SELECT) +#include <X11/Xpoll.h> +#define HLSLEEP do { \ + struct timeval sleeptime = { 0 , HLSLEEPINTERVAL * 1000 } ; \ + select(0, NULL, NULL, NULL, &sleeptime); \ + } while(0) +#else +#define HLSLEEP XSync(dpy, False) +#endif /* highlight mode */ typedef enum { drag, resize, done } hlMode; |