xserver-multidpi/hw/xwin/winclipboard
Jon TURNEY 94d433c8cb hw/xwin: Fix clipboard thread restart
It seems that the clipboard thread restart mechanism has been broken for a
while, which can be demonstrated using XDMCP with KDM (e.g. to a Kubutunu 12.04
host)

KDM kills all attached clients, including the clipboard integration client,
which restarts, but then exits on WM_QUIT.

Using PostQuitMessage() in WM_DESTROY is unhelpful, as we may not actually be
quitting the thread, if we just destroyed the window because the clipboard
thread is about to retry, because he WM_QUIT message sticks around, and is
noticed the next time we look at the window message queue and confuses us into
thinking we need to quit.

Sending a WM_DESTROY is apparently never correct anyhow, see [1]

So:

1/ Use DestroyWindow() to destroy the clipboard messaging window when cleaning
up for retry or exit in winClipboardProc (the clipboard thread main proc)

2/ Send a special WM_WM_QUIT message in winClipboardWindowDestroy() from the X
server thread when the X server is resetting.

3/ When processing that WM_WM_QUIT message in the clipboard thread, cause the
clipboard window to PostQuitMessage(), which causes the clipboard thread to
exit.

[1] http://blogs.msdn.com/b/oldnewthing/archive/2011/09/26/10216420.aspx

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2014-11-09 14:22:51 +00:00
..
debug.c hw/xwin: Add xwinclip test client 2014-09-13 14:18:38 +01:00
internal.h hw/xwin: Fix clipboard thread restart 2014-11-09 14:22:51 +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: Fix clipboard thread restart 2014-11-09 14:22:51 +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: Fix clipboard thread restart 2014-11-09 14:22:51 +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