Xming: Improve clipboard integration startup in XDMCP mode

Improve clipboard integration startup in XDMCP mode
Stop the "Clipboard not yet started, aborting" message from spamming the log.

Copyright (C) Colin Harrison 2005-2008
http://www.straightrunning.com/XmingNotes/
http://sourceforge.net/projects/xming/

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
This commit is contained in:
Colin Harrison 2009-02-03 15:52:57 +00:00 committed by Jon TURNEY
parent 7cb1622ce4
commit d8bae80305

View File

@ -42,6 +42,7 @@
* Constants * Constants
*/ */
#define CLIP_NUM_CALLS 4
#define CLIP_NUM_SELECTIONS 2 #define CLIP_NUM_SELECTIONS 2
#define CLIP_OWN_PRIMARY 0 #define CLIP_OWN_PRIMARY 0
#define CLIP_OWN_CLIPBOARD 1 #define CLIP_OWN_CLIPBOARD 1
@ -87,6 +88,8 @@ winProcQueryTree (ClientPtr client)
{ {
int iReturn; int iReturn;
ErrorF ("winProcQueryTree - Hello\n");
/* /*
* This procedure is only used for initialization. * This procedure is only used for initialization.
* We can unwrap the original procedure at this point * We can unwrap the original procedure at this point
@ -186,7 +189,7 @@ winProcEstablishConnection (ClientPtr client)
static int s_iCallCount = 0; static int s_iCallCount = 0;
static unsigned long s_ulServerGeneration = 0; static unsigned long s_ulServerGeneration = 0;
ErrorF ("winProcEstablishConnection - Hello\n"); if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) ErrorF ("winProcEstablishConnection - Hello\n");
/* Do nothing if clipboard is not enabled */ /* Do nothing if clipboard is not enabled */
if (!g_fClipboard) if (!g_fClipboard)
@ -214,13 +217,15 @@ winProcEstablishConnection (ClientPtr client)
/* Increment call count */ /* Increment call count */
++s_iCallCount; ++s_iCallCount;
/* Wait for second call when Xdmcp is enabled */ /* Wait for CLIP_NUM_CALLS when Xdmcp is enabled */
if (g_fXdmcpEnabled if (g_fXdmcpEnabled
&& !g_fClipboardLaunched && !g_fClipboardLaunched
&& s_iCallCount < 4) && s_iCallCount < CLIP_NUM_CALLS)
{ {
ErrorF ("winProcEstablishConnection - Xdmcp enabled, waiting to " if (s_iCallCount == 1) ErrorF ("winProcEstablishConnection - Xdmcp, waiting to "
"start clipboard client until fourth call.\n"); "start clipboard client until %dth call", CLIP_NUM_CALLS);
if (s_iCallCount == CLIP_NUM_CALLS - 1) ErrorF (".\n");
else ErrorF (".");
return (*winProcEstablishConnectionOrig) (client); return (*winProcEstablishConnectionOrig) (client);
} }
@ -277,7 +282,7 @@ winProcEstablishConnection (ClientPtr client)
* 8) Unfortunately, there is another problem. * 8) Unfortunately, there is another problem.
* 9) XDM walks the list of windows with XQueryTree, * 9) XDM walks the list of windows with XQueryTree,
* killing any client it finds with a window. * killing any client it finds with a window.
* 10)Thus, when using XDMCP we wait until the second call * 10)Thus, when using XDMCP we wait until CLIP_NUM_CALLS
* to ProcEstablishCeonnection before we startup the clipboard * to ProcEstablishCeonnection before we startup the clipboard
* client. This should prevent XDM from finding the clipboard * client. This should prevent XDM from finding the clipboard
* client, since it has not yet created a window. * client, since it has not yet created a window.
@ -337,8 +342,8 @@ winProcSetSelectionOwner (ClientPtr client)
/* Abort if clipboard not completely initialized yet */ /* Abort if clipboard not completely initialized yet */
if (!g_fClipboardStarted) if (!g_fClipboardStarted)
{ {
ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, " /* ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, "
"aborting.\n"); "aborting.\n"); */
goto winProcSetSelectionOwner_Done; goto winProcSetSelectionOwner_Done;
} }