diff options
author | Michel Hummel <hummel.michel@gmail.com> | 2010-10-23 18:35:57 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-10-31 16:07:54 +0000 |
commit | 1920e08443b16298bbe45418382f8c1da3753fd0 (patch) | |
tree | 1672e4f8476d4eec208f2c0120da23e8d09c9172 | |
parent | 07b473f22cbb36f6ac5eb9ac51d3e0add79a6d99 (diff) |
Remove no-longer needed tricks used to prevent the clipboard client from being killedmhummel-clipboard-thread-improvements
Remove no-longer needed tricks used to hide the clipboard client from XDM to prevent
it from being killed
- Delete XQuery wrapper used to hide clipboard client
- Delete XDMCP mode heuristic which waits until some magic number of connections have
been established before starting the clipboard
We still need the EstablishConnection wrapper to ensure that the clipboard client isn't
the first client (causing a server restart if it disconnects)
-rw-r--r-- | hw/xwin/InitInput.c | 8 | ||||
-rwxr-xr-x | hw/xwin/winclipboardwrappers.c | 121 |
2 files changed, 1 insertions, 128 deletions
diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c index 705e618de..f17a905f1 100644 --- a/hw/xwin/InitInput.c +++ b/hw/xwin/InitInput.c @@ -60,10 +60,8 @@ DeviceIntPtr g_pwinKeyboard; #ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; #endif -extern Bool g_fXdmcpEnabled; #ifdef XWIN_CLIPBOARD extern winDispatchProcPtr winProcEstablishConnectionOrig; -extern winDispatchProcPtr winProcQueryTreeOrig; #endif @@ -127,12 +125,6 @@ InitInput (int argc, char *argv[]) winProcEstablishConnectionOrig = InitialVector[2]; InitialVector[2] = winProcEstablishConnection; } - if (g_fXdmcpEnabled - && ProcVector[X_QueryTree] != winProcQueryTree) - { - winProcQueryTreeOrig = ProcVector[X_QueryTree]; - ProcVector[X_QueryTree] = winProcQueryTree; - } #endif g_pwinPointer = AddInputDevice (serverClient, winMouseProc, TRUE); diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c index 658d050d2..d8c013c66 100755 --- a/hw/xwin/winclipboardwrappers.c +++ b/hw/xwin/winclipboardwrappers.c @@ -42,7 +42,6 @@ * Constants */ -#define CLIP_NUM_CALLS 4 #define CLIP_NUM_SELECTIONS 2 #define CLIP_OWN_PRIMARY 0 #define CLIP_OWN_CLIPBOARD 1 @@ -53,7 +52,6 @@ */ DISPATCH_PROC(winProcEstablishConnection); -DISPATCH_PROC(winProcQueryTree); DISPATCH_PROC(winProcSetSelectionOwner); @@ -79,104 +77,6 @@ extern winDispatchProcPtr winProcSetSelectionOwnerOrig; /* - * Wrapper for internal QueryTree function. - * Hides the clipboard client when it is the only client remaining. - */ - -int -winProcQueryTree (ClientPtr client) -{ - int iReturn; - - ErrorF ("winProcQueryTree - Hello\n"); - - /* - * This procedure is only used for initialization. - * We can unwrap the original procedure at this point - * so that this function is no longer called until the - * server resets and the function is wrapped again. - */ - ProcVector[X_QueryTree] = winProcQueryTreeOrig; - - /* - * Call original function and bail if it fails. - * NOTE: We must do this first, since we need XdmcpOpenDisplay - * to be called before we initialize our clipboard client. - */ - iReturn = (*winProcQueryTreeOrig) (client); - if (iReturn != 0) - { - ErrorF ("winProcQueryTree - ProcQueryTree failed, bailing.\n"); - return iReturn; - } - - /* Make errors more obvious */ - winProcQueryTreeOrig = NULL; - - /* Do nothing if clipboard is not enabled */ - if (!g_fClipboard) - { - ErrorF ("winProcQueryTree - Clipboard is not enabled, " - "returning.\n"); - return iReturn; - } - - /* If the clipboard client has already been started, abort */ - if (g_fClipboardLaunched) - { - ErrorF ("winProcQueryTree - Clipboard client already " - "launched, returning.\n"); - return iReturn; - } - - /* Startup the clipboard client if clipboard mode is being used */ - if (g_fXdmcpEnabled && g_fClipboard) - { - /* - * NOTE: The clipboard client is started here for a reason: - * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%) - * 2) If the clipboard client attaches during X Server startup, - * then it becomes the "magic client" that causes the X Server - * to reset if it exits. - * 3) XDMCP calls KillAllClients when it starts up. - * 4) The clipboard client is a client, so it is killed. - * 5) The clipboard client is the "magic client", so the X Server - * resets itself. - * 6) This repeats ad infinitum. - * 7) We avoid this by waiting until at least one client (could - * be XDM, could be another client) connects, which makes it - * almost certain that the clipboard client will not connect - * until after XDM when using XDMCP. - * 8) Unfortunately, there is another problem. - * 9) XDM walks the list of windows with XQueryTree, - * killing any client it finds with a window. - * 10)Thus, when using XDMCP we wait until the first call - * to ProcQueryTree before we startup the clipboard client. - * This should prevent XDM from finding the clipboard client, - * since it has not yet created a window. - * 11)Startup when not using XDMCP is handled in - * winProcEstablishConnection. - */ - - /* Create the clipboard client thread */ - if (!winInitClipboard ()) - { - ErrorF ("winProcQueryTree - winClipboardInit " - "failed.\n"); - return iReturn; - } - - ErrorF ("winProcQueryTree - winInitClipboard returned.\n"); - } - - /* Flag that clipboard client has been launched */ - g_fClipboardLaunched = TRUE; - - return iReturn; -} - - -/* * Wrapper for internal EstablishConnection function. * Initializes internal clients that must not be started until * an external client has connected. @@ -189,7 +89,7 @@ winProcEstablishConnection (ClientPtr client) static int s_iCallCount = 0; static unsigned long s_ulServerGeneration = 0; - if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) ErrorF ("winProcEstablishConnection - Hello\n"); + if (s_iCallCount == 0) ErrorF ("winProcEstablishConnection - Hello\n"); /* Do nothing if clipboard is not enabled */ if (!g_fClipboard) @@ -217,18 +117,6 @@ winProcEstablishConnection (ClientPtr client) /* Increment call count */ ++s_iCallCount; - /* Wait for CLIP_NUM_CALLS when Xdmcp is enabled */ - if (g_fXdmcpEnabled - && !g_fClipboardLaunched - && s_iCallCount < CLIP_NUM_CALLS) - { - if (s_iCallCount == 1) ErrorF ("winProcEstablishConnection - Xdmcp, waiting to " - "start clipboard client until %dth call", CLIP_NUM_CALLS); - if (s_iCallCount == CLIP_NUM_CALLS - 1) ErrorF (".\n"); - else ErrorF ("."); - return (*winProcEstablishConnectionOrig) (client); - } - /* * This procedure is only used for initialization. * We can unwrap the original procedure at this point @@ -279,13 +167,6 @@ winProcEstablishConnection (ClientPtr client) * be XDM, could be another client) connects, which makes it * almost certain that the clipboard client will not connect * until after XDM when using XDMCP. - * 8) Unfortunately, there is another problem. - * 9) XDM walks the list of windows with XQueryTree, - * killing any client it finds with a window. - * 10)Thus, when using XDMCP we wait until CLIP_NUM_CALLS - * to ProcEstablishCeonnection before we startup the clipboard - * client. This should prevent XDM from finding the clipboard - * client, since it has not yet created a window. */ /* Create the clipboard client thread */ |