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_fUnicodeClipboard;
|
||||||
extern Bool g_fClipboard;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
|
@ -85,10 +84,12 @@ static int
|
||||||
winClipboardIOErrorHandler(Display * pDisplay);
|
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)
|
winClipboardProc(char *szDisplay)
|
||||||
{
|
{
|
||||||
Atom atomClipboard;
|
Atom atomClipboard;
|
||||||
|
@ -108,6 +109,7 @@ winClipboardProc(char *szDisplay)
|
||||||
int iRetries;
|
int iRetries;
|
||||||
Bool fUseUnicode;
|
Bool fUseUnicode;
|
||||||
int iSelectError;
|
int iSelectError;
|
||||||
|
Bool fShutdown = FALSE;
|
||||||
|
|
||||||
winDebug("winClipboardProc - Hello\n");
|
winDebug("winClipboardProc - Hello\n");
|
||||||
|
|
||||||
|
@ -349,8 +351,8 @@ winClipboardProc(char *szDisplay)
|
||||||
}
|
}
|
||||||
|
|
||||||
winClipboardProc_Exit:
|
winClipboardProc_Exit:
|
||||||
/* disable the clipboard, which means the thread will die */
|
/* broke out of while loop on a shutdown message */
|
||||||
g_fClipboard = FALSE;
|
fShutdown = TRUE;
|
||||||
|
|
||||||
winClipboardProc_Done:
|
winClipboardProc_Done:
|
||||||
/* Close our Windows window */
|
/* Close our Windows window */
|
||||||
|
@ -394,7 +396,7 @@ winClipboardProc(char *szDisplay)
|
||||||
/* global clipboard variable reset */
|
/* global clipboard variable reset */
|
||||||
g_hwndClipboard = NULL;
|
g_hwndClipboard = NULL;
|
||||||
|
|
||||||
return NULL;
|
return fShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -96,7 +96,7 @@ void
|
||||||
* winclipboardthread.c
|
* winclipboardthread.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void *winClipboardProc(char *szDisplay);
|
Bool winClipboardProc(char *szDisplay);
|
||||||
|
|
||||||
void
|
void
|
||||||
winClipboardWindowDestroy(void);
|
winClipboardWindowDestroy(void);
|
||||||
|
|
|
@ -68,6 +68,8 @@ winClipboardThreadProc(void *arg)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
Bool fShutdown;
|
||||||
|
|
||||||
++clipboardRestarts;
|
++clipboardRestarts;
|
||||||
|
|
||||||
/* Use our generated cookie for authentication */
|
/* Use our generated cookie for authentication */
|
||||||
|
@ -89,11 +91,14 @@ winClipboardThreadProc(void *arg)
|
||||||
/* Flag that clipboard client has been launched */
|
/* Flag that clipboard client has been launched */
|
||||||
g_fClipboardStarted = TRUE;
|
g_fClipboardStarted = TRUE;
|
||||||
|
|
||||||
winClipboardProc(szDisplay);
|
fShutdown = winClipboardProc(szDisplay);
|
||||||
|
|
||||||
/* Flag that clipboard client has stopped */
|
/* Flag that clipboard client has stopped */
|
||||||
g_fClipboardStarted = FALSE;
|
g_fClipboardStarted = FALSE;
|
||||||
|
|
||||||
|
if (fShutdown)
|
||||||
|
break;
|
||||||
|
|
||||||
/* checking if we need to restart */
|
/* checking if we need to restart */
|
||||||
if (clipboardRestarts >= WIN_CLIPBOARD_RETRIES) {
|
if (clipboardRestarts >= WIN_CLIPBOARD_RETRIES) {
|
||||||
/* terminates clipboard thread but the main server still lives */
|
/* terminates clipboard thread but the main server still lives */
|
||||||
|
|
Loading…
Reference in New Issue