hw/xwin: Return a shutdown flag from winClipboardProc() if we should stop trying
Return a shutdown flag from winClipboardProc(), and use it in winClipboardThreadProc() to determine if we should stop. Currently this is set if the clipboard messaging window received a WM_QUIT. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
88d4459704
commit
30c535219e
|
@ -56,7 +56,6 @@
|
|||
*/
|
||||
|
||||
extern Bool g_fUnicodeClipboard;
|
||||
extern Bool g_fClipboard;
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
|
@ -85,10 +84,12 @@ static int
|
|||
winClipboardIOErrorHandler(Display * pDisplay);
|
||||
|
||||
/*
|
||||
* Main thread function
|
||||
* Create X11 and Win32 messaging windows, and run message processing loop
|
||||
*
|
||||
* returns TRUE if shutdown was signalled to loop, FALSE if some error occurred
|
||||
*/
|
||||
|
||||
void *
|
||||
Bool
|
||||
winClipboardProc(char *szDisplay)
|
||||
{
|
||||
Atom atomClipboard;
|
||||
|
@ -108,6 +109,7 @@ winClipboardProc(char *szDisplay)
|
|||
int iRetries;
|
||||
Bool fUseUnicode;
|
||||
int iSelectError;
|
||||
Bool fShutdown = FALSE;
|
||||
|
||||
winDebug("winClipboardProc - Hello\n");
|
||||
|
||||
|
@ -349,8 +351,8 @@ winClipboardProc(char *szDisplay)
|
|||
}
|
||||
|
||||
winClipboardProc_Exit:
|
||||
/* disable the clipboard, which means the thread will die */
|
||||
g_fClipboard = FALSE;
|
||||
/* broke out of while loop on a shutdown message */
|
||||
fShutdown = TRUE;
|
||||
|
||||
winClipboardProc_Done:
|
||||
/* Close our Windows window */
|
||||
|
@ -394,7 +396,7 @@ winClipboardProc(char *szDisplay)
|
|||
/* global clipboard variable reset */
|
||||
g_hwndClipboard = NULL;
|
||||
|
||||
return NULL;
|
||||
return fShutdown;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -96,7 +96,7 @@ void
|
|||
* winclipboardthread.c
|
||||
*/
|
||||
|
||||
void *winClipboardProc(char *szDisplay);
|
||||
Bool winClipboardProc(char *szDisplay);
|
||||
|
||||
void
|
||||
winClipboardWindowDestroy(void);
|
||||
|
|
|
@ -68,6 +68,8 @@ winClipboardThreadProc(void *arg)
|
|||
|
||||
while (1)
|
||||
{
|
||||
Bool fShutdown;
|
||||
|
||||
++clipboardRestarts;
|
||||
|
||||
/* Use our generated cookie for authentication */
|
||||
|
@ -89,11 +91,14 @@ winClipboardThreadProc(void *arg)
|
|||
/* Flag that clipboard client has been launched */
|
||||
g_fClipboardStarted = TRUE;
|
||||
|
||||
winClipboardProc(szDisplay);
|
||||
fShutdown = winClipboardProc(szDisplay);
|
||||
|
||||
/* Flag that clipboard client has stopped */
|
||||
g_fClipboardStarted = FALSE;
|
||||
|
||||
if (fShutdown)
|
||||
break;
|
||||
|
||||
/* checking if we need to restart */
|
||||
if (clipboardRestarts >= WIN_CLIPBOARD_RETRIES) {
|
||||
/* terminates clipboard thread but the main server still lives */
|
||||
|
|
Loading…
Reference in New Issue
Block a user