summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-06-17 13:18:16 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2014-01-04 16:15:07 +0000
commite09a6e45eaed6a6cd39914dc5283574f92310eb7 (patch)
tree383329ff2e50ef619b64a2f4ff61277c9ee9c24e
parent54999bc516074dec66d5129e0c7f152cc6836227 (diff)
Make g_hwndClipboard static
Move winFixClipboardChain() into winclipboardthread.c Add winCLipboardWindowDestroy() function to access it for WM_DESTROY
-rw-r--r--hw/xwin/winclipboard.h3
-rw-r--r--hw/xwin/winclipboardinit.c15
-rw-r--r--hw/xwin/winclipboardthread.c25
-rw-r--r--hw/xwin/winglobals.c4
4 files changed, 23 insertions, 24 deletions
diff --git a/hw/xwin/winclipboard.h b/hw/xwin/winclipboard.h
index 9e92ee8b2..f12368de8 100644
--- a/hw/xwin/winclipboard.h
+++ b/hw/xwin/winclipboard.h
@@ -96,6 +96,9 @@ void
void *winClipboardProc(char *szDisplay);
+void
+winClipboardWindowDestroy(void);
+
/*
* winclipboardwndproc.c
*/
diff --git a/hw/xwin/winclipboardinit.c b/hw/xwin/winclipboardinit.c
index 335e37920..8e318abe1 100644
--- a/hw/xwin/winclipboardinit.c
+++ b/hw/xwin/winclipboardinit.c
@@ -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);
@@ -151,10 +145,3 @@ winClipboardShutdown(void)
}
}
-void
-winFixClipboardChain(void)
-{
- if (g_fClipboard && g_hwndClipboard) {
- PostMessage(g_hwndClipboard, WM_WM_REINIT, 0, 0);
- }
-}
diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index aa834009c..316c232b9 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -56,12 +56,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;
@@ -228,7 +228,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 */
@@ -361,10 +361,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 */
@@ -495,3 +492,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);
+ }
+}
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 8eaaf385a..ad82b83f6 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -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
}