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>2013-06-20 14:30:09 +0100
commit2f62087f831403510763a3f146c89089a9a3ac4c (patch)
treebaf8e586d840071401bc3b9efa29e4db782eb28c
parentc5bce0df129d7b33c8f42f511921614f60125e93 (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 21bd00cb4..233081c78 100644
--- a/hw/xwin/winclipboard.h
+++ b/hw/xwin/winclipboard.h
@@ -97,6 +97,9 @@ void
void *winClipboardProc(char *szDisplay);
+void
+winClipboardWindowDestroy(void);
+
/*
* winclipboardwndproc.c
*/
diff --git a/hw/xwin/winclipboardinit.c b/hw/xwin/winclipboardinit.c
index 4fa929891..3d790bf4d 100644
--- a/hw/xwin/winclipboardinit.c
+++ b/hw/xwin/winclipboardinit.c
@@ -49,7 +49,6 @@ extern void winGetDisplayName(char *szDisplay, unsigned int screen);
*/
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 92ed3f951..cfbd90f2e 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 */
@@ -368,10 +368,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 */
@@ -502,3 +499,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
}