hw/xwin: Make g_hwndClipboard static

Move winFixClipboardChain() into winclipboardthread.c
Add winCLipboardWindowDestroy() function to access it for WM_DESTROY

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2013-06-17 13:18:16 +01:00
parent 03a59e7f78
commit e965001a73
4 changed files with 23 additions and 25 deletions

View File

@ -97,6 +97,9 @@ void
void *winClipboardProc(char *szDisplay);
void
winClipboardWindowDestroy(void);
/*
* winclipboardwndproc.c
*/

View File

@ -49,7 +49,6 @@ extern void winSetAuthorization(void);
*/
extern Bool g_fClipboard;
extern HWND g_hwndClipboard;
extern Bool g_fClipboardStarted;
/*
@ -135,12 +134,7 @@ winClipboardShutdown(void)
/* Close down clipboard resources */
if (g_fClipboard && g_fClipboardStarted) {
/* Synchronously destroy the clipboard window */
if (g_hwndClipboard != NULL) {
SendMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
/* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */
}
else
return;
winClipboardWindowDestroy();
/* Wait for the clipboard thread to exit */
pthread_join(g_ptClipboardProc, NULL);
@ -150,11 +144,3 @@ winClipboardShutdown(void)
winDebug("winClipboardShutdown - Clipboard thread has exited.\n");
}
}
void
winFixClipboardChain(void)
{
if (g_fClipboard && g_hwndClipboard) {
PostMessage(g_hwndClipboard, WM_WM_REINIT, 0, 0);
}
}

View File

@ -57,12 +57,12 @@
extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboard;
extern HWND g_hwndClipboard;
/*
* Global variables
*/
static HWND g_hwndClipboard = NULL;
static jmp_buf g_jmpEntry;
static XIOErrorHandler g_winClipboardOldIOErrorHandler;
static pthread_t g_winClipboardProcThread;
@ -240,7 +240,7 @@ winClipboardProc(char *szDisplay)
/* Create Windows messaging window */
hwnd = winClipboardCreateMessagingWindow(pDisplay, iWindow);
/* Save copy of HWND in screen privates */
/* Save copy of HWND */
g_hwndClipboard = hwnd;
/* Assert ownership of selections if Win32 clipboard is owned */
@ -355,10 +355,7 @@ winClipboardProc(char *szDisplay)
winClipboardProc_Done:
/* Close our Windows window */
if (g_hwndClipboard) {
/* Destroy the Window window (hwnd) */
winDebug("winClipboardProc - Destroy Windows window\n");
PostMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
winClipboardFlushWindowsMessageQueue(g_hwndClipboard);
winClipboardWindowDestroy();
}
/* Close our X window */
@ -489,3 +486,19 @@ winClipboardIOErrorHandler(Display * pDisplay)
return 0;
}
void
winClipboardWindowDestroy(void)
{
if (g_hwndClipboard) {
SendMessage(g_hwndClipboard, WM_DESTROY, 0, 0);
}
}
void
winFixClipboardChain(void)
{
if (g_hwndClipboard) {
PostMessage(g_hwndClipboard, WM_WM_REINIT, 0, 0);
}
}

View File

@ -94,7 +94,6 @@ winDispatchProcPtr winProcEstablishConnectionOrig = NULL;
Bool g_fUnicodeClipboard = TRUE;
Bool g_fClipboard = TRUE;
Bool g_fClipboardStarted = FALSE;
HWND g_hwndClipboard = NULL;
#endif
/*
@ -106,7 +105,4 @@ void
winInitializeGlobals(void)
{
g_dwCurrentThreadID = GetCurrentThreadId();
#ifdef XWIN_CLIPBOARD
g_hwndClipboard = NULL;
#endif
}