diff options
Diffstat (limited to 'hw/xwin/winclipboard/thread.c')
-rw-r--r-- | hw/xwin/winclipboard/thread.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/hw/xwin/winclipboard/thread.c b/hw/xwin/winclipboard/thread.c index 2b9a6f34f..1653747ea 100644 --- a/hw/xwin/winclipboard/thread.c +++ b/hw/xwin/winclipboard/thread.c @@ -244,24 +244,26 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay) } } - /* Pre-flush X events */ - /* - * NOTE: Apparently you'll freeze if you don't do this, - * because there may be events in local data structures - * already. - */ ClipboardConversionData data; data.fUseUnicode = fUseUnicode; - winClipboardFlushXEvents(hwnd, iWindow, pDisplay, &data, &atoms); - - /* Pre-flush Windows messages */ - if (!winClipboardFlushWindowsMessageQueue(hwnd)) { - ErrorF("winClipboardProc - winClipboardFlushWindowsMessageQueue failed\n"); - pthread_exit(NULL); - } - /* Loop for X events */ + /* Loop for events */ while (1) { + + /* Process X events */ + winClipboardFlushXEvents(hwnd, + iWindow, pDisplay, &data, &atoms); + + /* Process Windows messages */ + if (!winClipboardFlushWindowsMessageQueue(hwnd)) { + ErrorF("winClipboardProc - winClipboardFlushWindowsMessageQueue trapped " + "WM_QUIT message, exiting main loop.\n"); + break; + } + + /* We need to ensure that all pending requests are sent */ + XFlush(pDisplay); + /* Setup the file descriptor set */ /* * NOTE: You have to do this before every call to select @@ -312,14 +314,9 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay) winDebug("winClipboardProc - select returned %d\n", iReturn); - /* Branch on which descriptor became active */ if (FD_ISSET(iConnectionNumber, &fdsRead)) { winDebug ("winClipboardProc - X connection ready, pumping X event queue\n"); - - /* Process X events */ - winClipboardFlushXEvents(hwnd, - iWindow, pDisplay, &data, &atoms); } #ifdef HAS_DEVWINDOWS @@ -331,20 +328,12 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay) { winDebug ("winClipboardProc - /dev/windows ready, pumping Windows message queue\n"); - - /* Process Windows messages */ - if (!winClipboardFlushWindowsMessageQueue(hwnd)) { - ErrorF("winClipboardProc - " - "winClipboardFlushWindowsMessageQueue trapped " - "WM_QUIT message, exiting main loop.\n"); - break; - } } #ifdef HAS_DEVWINDOWS if (!(FD_ISSET(iConnectionNumber, &fdsRead)) && !(FD_ISSET(fdMessageQueue, &fdsRead))) { - winDebug("winClipboardProc - Spurious wake\n"); + winDebug("winClipboardProc - Spurious wake, select() returned %d\n", iReturn); } #endif } |