From 0c4329a8c4a0458669ee473042198e478c28384f Mon Sep 17 00:00:00 2001 From: Harold L Hunt II Date: Wed, 3 Mar 2004 03:08:59 +0000 Subject: [PATCH] Try to close the clipboard if it is open before we try to open it. --- hw/xwin/winclipboardwndproc.c | 8 +++++++- hw/xwin/winclipboardwrappers.c | 6 ++++++ hw/xwin/winclipboardxevents.c | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c index 51a08c53f..db1e1634b 100644 --- a/hw/xwin/winclipboardwndproc.c +++ b/hw/xwin/winclipboardwndproc.c @@ -323,7 +323,13 @@ winClipboardWindowProc (HWND hwnd, UINT message, if (message == WM_RENDERALLFORMATS) { /* We must open and empty the clipboard */ - + + /* Close clipboard if we have it open already */ + if (GetOpenClipboardWindow () == hwnd) + { + CloseClipboard (); + } + if (!OpenClipboard (hwnd)) { ErrorF ("winClipboardWindowProc - WM_RENDER*FORMATS - " diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c index c5c486401..33881e28c 100755 --- a/hw/xwin/winclipboardwrappers.c +++ b/hw/xwin/winclipboardwrappers.c @@ -459,6 +459,12 @@ winProcSetSelectionOwner (ClientPtr client) goto winProcSetSelectionOwner_Done; } + /* Close clipboard if we have it open already */ + if (GetOpenClipboardWindow () == g_hwndClipboard) + { + CloseClipboard (); + } + /* Access the Windows clipboard */ if (!OpenClipboard (g_hwndClipboard)) { diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c index 012b0208d..49cca10fb 100644 --- a/hw/xwin/winclipboardxevents.c +++ b/hw/xwin/winclipboardxevents.c @@ -193,6 +193,12 @@ winClipboardFlushXEvents (HWND hwnd, goto winClipboardFlushXEvents_SelectionRequest_Done; } + /* Close clipboard if we have it open already */ + if (GetOpenClipboardWindow () == hwnd) + { + CloseClipboard (); + } + /* Access the clipboard */ if (!OpenClipboard (hwnd)) {