diff --git a/hw/xwin/winclipboard.h b/hw/xwin/winclipboard.h index fcda6bfa0..fa32c6253 100644 --- a/hw/xwin/winclipboard.h +++ b/hw/xwin/winclipboard.h @@ -71,7 +71,6 @@ * References to external symbols */ -extern char *display; extern void winDebug(const char *format, ...); extern void winErrorFVerb(int verb, const char *format, ...); @@ -96,7 +95,7 @@ void * winclipboardthread.c */ -void *winClipboardProc(void *); +void *winClipboardProc(char *szDisplay); /* * winclipboardwndproc.c diff --git a/hw/xwin/winclipboardinit.c b/hw/xwin/winclipboardinit.c index 07e57eebf..335e37920 100644 --- a/hw/xwin/winclipboardinit.c +++ b/hw/xwin/winclipboardinit.c @@ -37,10 +37,13 @@ #include "os.h" #include "winclipboard.h" +#include "windisplay.h" #define WIN_CLIPBOARD_RETRIES 40 #define WIN_CLIPBOARD_DELAY 1 +extern void winSetAuthorization(void); + /* * References to external symbols */ @@ -61,16 +64,33 @@ static pthread_t g_ptClipboardProc; static void * winClipboardThreadProc(void *arg) { + char szDisplay[512]; int clipboardRestarts = 0; while (1) { ++clipboardRestarts; + /* Use our generated cookie for authentication */ + winSetAuthorization(); + + /* Setup the display connection string */ + /* + * NOTE: Always connect to screen 0 since we require that screen + * numbers start at 0 and increase without gaps. We only need + * to connect to one screen on the display to get events + * for all screens on the display. That is why there is only + * one clipboard client thread. + */ + winGetDisplayName(szDisplay, 0); + + /* Print the display connection string */ + ErrorF("winClipboardThreadProc - DISPLAY=%s\n", szDisplay); + /* Flag that clipboard client has been launched */ g_fClipboardStarted = TRUE; - winClipboardProc(arg); + winClipboardProc(szDisplay); /* Flag that clipboard client has stopped */ g_fClipboardStarted = FALSE; diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c index f9089ffc0..3d49606ba 100644 --- a/hw/xwin/winclipboardthread.c +++ b/hw/xwin/winclipboardthread.c @@ -89,7 +89,7 @@ static int */ void * -winClipboardProc(void *pvNotUsed) +winClipboardProc(char *szDisplay) { Atom atomClipboard; int iReturn; @@ -107,7 +107,6 @@ winClipboardProc(void *pvNotUsed) Window iWindow = None; int iRetries; Bool fUseUnicode; - char szDisplay[512]; int iSelectError; winDebug("winClipboardProc - Hello\n"); @@ -150,24 +149,9 @@ winClipboardProc(void *pvNotUsed) goto winClipboardProc_Done; } - /* Use our generated cookie for authentication */ - winSetAuthorization(); - /* Initialize retry count */ iRetries = 0; - /* Setup the display connection string x */ - /* - * NOTE: Always connect to screen 0 since we require that screen - * numbers start at 0 and increase without gaps. We only need - * to connect to one screen on the display to get events - * for all screens on the display. That is why there is only - * one clipboard client thread. - */ - winGetDisplayName(szDisplay, 0); - - /* Print the display connection string */ - ErrorF("winClipboardProc - DISPLAY=%s\n", szDisplay); /* Open the X display */ do {