diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-06-30 18:09:58 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-07-05 17:20:09 +0100 |
commit | 6da3190eacae2c2b021060f8fd9427816ac06f21 (patch) | |
tree | bc3befeeb50f6ddb23d3327e897d5ae6cedeb054 | |
parent | 8c61b9bd26fe13c306892376f5f83073aeaaf14e (diff) |
Cygwin/X: Make select() only poll and not block if there are unprocessed Windows messages
This is a workaround for select() sometimes not finding /dev/windows ready,
even if there are unprocessed Windows messages
-rw-r--r-- | hw/xwin/winblock.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c index bdf0a2408..71a8dee00 100644 --- a/hw/xwin/winblock.c +++ b/hw/xwin/winblock.c @@ -62,6 +62,24 @@ winBlockHandler (int nScreen, (*tvp)->tv_sec = 0; (*tvp)->tv_usec = 100; } +#else + /* + Sometimes, we have work to do on the Windows message queue, + but /dev/windows doesn't appear to be ready. At the moment, + I don't understand how that happens. + + As a workaround, make sure select() just polls rather than + blocking if there are still messages to process... + */ + if (GetQueueStatus(QS_ALLINPUT | QS_ALLPOSTMESSAGE) != 0) + { + struct timeval **tvp = pTimeout; + if (*tvp != NULL) + { + (*tvp)->tv_sec = 0; + (*tvp)->tv_usec = 0; + } + } #endif #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) |