xserver-multidpi/hw/xwin/winclipboard
Jon TURNEY b4a08e642b hw/xwin: Improve reliability of clipboard X->Windows pastes
Sometimes, particularly with large clipboard pastes to Windows, we could end up
waiting for the timeout to expire, rather than pasting the data.

Various changes to improve reliability:

1. Use XFlush() not XSync() in winProcessXEventsTimeout().

It makes no sense to ensure we have received replies to outstanding requests if
we are going to wait for them using select()

2. Add XFlush() to winClipboardProc()

Make sure we have sent any requests before we wait using select()

3. Don't use FD_ISSET() to check which fd is ready

This looks like a Cygwin select() bug in that it sometimes returns 0 with an
empty fd set before the timeout expires, but a fd appears to be ready.

Add select() return value to debug output when we are warning that this has
happened.

4. Drain event queues before entering select()

Unconditionally drain event queues before entering select().  This seems to be
the recommended way of writing select() and X event processing loops.

winClipboardFlushXEvents() checks using XPending(), and
winClipboardFlushWindowsMessageQueue() checks using PeekMessage() so this is
safe against blocking, but means that may not need to enter select() at all
sometimes.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2014-11-09 14:22:48 +00:00
..
debug.c hw/xwin: Add xwinclip test client 2014-09-13 14:18:38 +01:00
internal.h hw/xwin: Retrieve TARGETS to avoid unnecessary failing conversion attempts 2014-11-06 12:23:03 +00:00
Makefile.am hw/xwin: Undefine _XSERVER64 in hw/xwin/winclipboard 2014-09-13 14:19:06 +01:00
textconv.c hw/xwin: Undefine _XSERVER64 in hw/xwin/winclipboard 2014-09-13 14:19:06 +01:00
thread.c hw/xwin: Improve reliability of clipboard X->Windows pastes 2014-11-09 14:22:48 +00:00
winclipboard.h hw/xwin: Add controls for enabling/disabling monitoring of PRIMARY selection 2014-11-09 14:22:35 +00:00
wndproc.c hw/xwin: Improve reliability of clipboard X->Windows pastes 2014-11-09 14:22:48 +00:00
xevents.c hw/xwin: Add controls for enabling/disabling monitoring of PRIMARY selection 2014-11-09 14:22:35 +00:00
xwinclip.c hw/xwin: Add controls for enabling/disabling monitoring of PRIMARY selection 2014-11-09 14:22:35 +00:00
xwinclip.man hw/xwin: Add controls for enabling/disabling monitoring of PRIMARY selection 2014-11-09 14:22:35 +00:00