aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winclipboard/wndproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winclipboard/wndproc.c')
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winclipboard/wndproc.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/xorg-server/hw/xwin/winclipboard/wndproc.c b/xorg-server/hw/xwin/winclipboard/wndproc.c
index 1ea5bc6b7..219085682 100644..100755
--- a/xorg-server/hw/xwin/winclipboard/wndproc.c
+++ b/xorg-server/hw/xwin/winclipboard/wndproc.c
@@ -49,6 +49,11 @@
#include <X11/Xatom.h>
+#include "misc.h"
+#include "winmsg.h"
+#include "objbase.h"
+#include "ddraw.h"
+#include "winwindow.h"
#include "internal.h"
#include "winclipboard.h"
@@ -58,6 +63,15 @@
#define WIN_POLL_TIMEOUT 1
+/*
+ * References to external symbols
+ */
+
+extern void *g_pClipboardDisplay;
+extern Window g_iClipboardWindow;
+extern Atom g_atomLastOwnedSelection;
+extern Bool g_fClipboardStarted;
+extern HWND g_hwndClipboard;
/*
* Process X events up to specified timeout
@@ -118,8 +132,8 @@ winProcessXEventsTimeout(HWND hwnd, Window iWindow, Display * pDisplay,
NULL, /* No exception mask */
&tv); /* Timeout */
if (iReturn < 0) {
- ErrorF("winProcessXEventsTimeout - Call to select () failed: %d. "
- "Bailing.\n", iReturn);
+ ErrorF("winProcessXEventsTimeout - Call to select () failed: %d (%x). "
+ "Bailing.\n", iReturn, WSAGetLastError());
break;
}
@@ -155,6 +169,8 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
ChangeClipboardChain(hwnd, s_hwndNextViewer);
s_hwndNextViewer = NULL;
+ g_hwndClipboard = NULL;
+ PostMessage(hwnd, WM_WM_QUIT, 0L, 0L);
}
return 0;
@@ -230,7 +246,8 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
HWND first, next;
DWORD error_code = 0;
-
+ if (!g_hwndClipboard)
+ return 0;
winDebug("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
@@ -261,7 +278,14 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
static Bool s_fProcessingDrawClipboard = FALSE;
int iReturn;
- winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n");
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD 0x%x 0x%x 0x%x: Enter\n",hwnd,wParam,lParam);
+
+ if (!g_fClipboardStarted) {
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit with no processing\n");
+ if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message, wParam, lParam);
+ return 0;
+ }
/*
* We've occasionally seen a loop in the clipboard chain.
@@ -274,7 +298,7 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
s_fCBCInitialized = FALSE;
ChangeClipboardChain(hwnd, s_hwndNextViewer);
- winFixClipboardChain();
+ winFixClipboardChain(1);
ErrorF("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
"Nested calls detected. Re-initing.\n");
winDebug("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");