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> | 2011-10-05 15:12:11 +0100 |
commit | fecaf3b009527dec335e4fbdb6287087d4279c06 (patch) | |
tree | d220060a983d3c66e63e50ca2ebbb0c0150f6e64 | |
parent | f0fabdcd48c092ee76e49fa626fe67e227c9f410 (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 2965e9f3a..4362197b2 100644 --- a/hw/xwin/winblock.c +++ b/hw/xwin/winblock.c @@ -52,6 +52,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) |