From e917c45e1fe37347084167de1b92dd10ee63bebf Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 2 Nov 2010 08:25:18 +0000 Subject: Remove no-longer needed tricks used to hide the clipboard client from XDM to prevent it from being killed --- xorg-server/hw/xwin/InitInput.c | 7 -- xorg-server/hw/xwin/winclipboardwrappers.c | 124 +---------------------------- xorg-server/hw/xwin/winglobals.c | 1 - xorg-server/hw/xwin/winglobals.h | 1 - 4 files changed, 1 insertion(+), 132 deletions(-) (limited to 'xorg-server/hw/xwin') diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c index 7560e6920..0e71e1271 100644 --- a/xorg-server/hw/xwin/InitInput.c +++ b/xorg-server/hw/xwin/InitInput.c @@ -40,7 +40,6 @@ #ifdef XWIN_CLIPBOARD int winProcEstablishConnection(ClientPtr /* client */); -int winProcQueryTree(ClientPtr /* client */); int winProcSetSelectionOwner(ClientPtr /* client */); #endif @@ -102,12 +101,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/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c index 3155b8c1f..e7325178d 100644 --- a/xorg-server/hw/xwin/winclipboardwrappers.c +++ b/xorg-server/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 @@ */ int winProcEstablishConnection(ClientPtr /* client */); -int winProcQueryTree(ClientPtr /* client */); int winProcSetSelectionOwner(ClientPtr /* client */); @@ -74,108 +72,9 @@ extern Atom g_atomLastOwnedSelection; extern HWND g_hwndClipboard; extern winDispatchProcPtr winProcEstablishConnectionOrig; -extern winDispatchProcPtr winProcQueryTreeOrig; 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; - - winDebug ("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) - { - winDebug ("winProcQueryTree - Clipboard is not enabled, " - "returning.\n"); - return iReturn; - } - - /* If the clipboard client has already been started, abort */ - if (g_fClipboardLaunched) - { - winDebug ("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; - } - - winDebug ("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 @@ -190,7 +89,7 @@ winProcEstablishConnection (ClientPtr client) static unsigned long s_ulServerGeneration = 0; #ifdef WINDBG - if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) winDebug ("winProcEstablishConnection - Hello\n"); + if (s_iCallCount == 0) winDebug ("winProcEstablishConnection - Hello\n"); #endif /* Do nothing if clipboard is not enabled */ @@ -219,20 +118,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) - { - #ifdef WINDBG - if (s_iCallCount == 1) winDebug ("winProcEstablishConnection - Xdmcp, waiting to " - "start clipboard client until %dth call", CLIP_NUM_CALLS); - if (s_iCallCount == CLIP_NUM_CALLS - 1) winDebug (".\n"); - else winDebug ("."); - #endif - return (*winProcEstablishConnectionOrig) (client); - } - /* * This procedure is only used for initialization. * We can unwrap the original procedure at this point @@ -283,13 +168,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 */ diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c index f80d09364..49b111564 100644 --- a/xorg-server/hw/xwin/winglobals.c +++ b/xorg-server/hw/xwin/winglobals.c @@ -91,7 +91,6 @@ FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; * Wrapped DIX functions */ winDispatchProcPtr winProcEstablishConnectionOrig = NULL; -winDispatchProcPtr winProcQueryTreeOrig = NULL; winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL; diff --git a/xorg-server/hw/xwin/winglobals.h b/xorg-server/hw/xwin/winglobals.h index 898b9388a..dd7c72949 100644 --- a/xorg-server/hw/xwin/winglobals.h +++ b/xorg-server/hw/xwin/winglobals.h @@ -64,7 +64,6 @@ typedef int (*winDispatchProcPtr) (ClientPtr); * Wrapped DIX functions */ extern winDispatchProcPtr winProcEstablishConnectionOrig; -extern winDispatchProcPtr winProcQueryTreeOrig; extern winDispatchProcPtr winProcSetSelectionOwnerOrig; #endif -- cgit v1.2.3