summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2010-10-06 16:47:45 +0200
committerArnon Gilboa <agilboa@agilboa.usersys.redhat.com>2010-10-11 17:29:44 +0200
commit1148edfea4593a72694375367cd97097e9dfced5 (patch)
tree1ce4cfc97354ac85bc5b6b38d900c073b9ef977f
parentf2ef521740d3b5a0bdc03408dc1648197c919f83 (diff)
downloadspice-1148edfea4593a72694375367cd97097e9dfced5.tar.gz
spice-1148edfea4593a72694375367cd97097e9dfced5.tar.xz
spice-1148edfea4593a72694375367cd97097e9dfced5.zip
spice-win: remove clipboard_changer hack
Instead of keeping a flag, we simply check wether the new owner is us or not
-rw-r--r--client/windows/platform.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 4df7d435..9361180f 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -64,11 +64,6 @@ static Platform::ClipboardListener* clipboard_listener = &default_clipboard_list
static HWND next_clipboard_viewer_win = NULL;
static HANDLE clipboard_event = NULL;
-// clipboard_changer says whether the client was the last one to change cliboard, for loop
-// prevention. It's initialized to true so we ignore the first clipboard change event which
-// happens right when we call SetClipboardViewer().
-static bool clipboard_changer = true;
-
static const int CLIPBOARD_TIMEOUT_MS = 10000;
typedef struct ClipboardFormat {
@@ -149,7 +144,8 @@ static LRESULT CALLBACK PlatformWinProc(HWND hWnd, UINT message, WPARAM wParam,
}
break;
case WM_DRAWCLIPBOARD:
- if (!clipboard_changer) {
+ if (platform_win != GetClipboardOwner()) {
+ Platform::set_clipboard_owner(Platform::owner_none);
//FIXME: handle multiple types
uint32_t type = get_available_clipboard_type();
if (type) {
@@ -157,8 +153,6 @@ static LRESULT CALLBACK PlatformWinProc(HWND hWnd, UINT message, WPARAM wParam,
} else {
LOG_INFO("Unsupported clipboard format");
}
- } else {
- clipboard_changer = false;
}
if (next_clipboard_viewer_win) {
SendMessage(next_clipboard_viewer_win, message, wParam, lParam);
@@ -890,7 +884,6 @@ bool Platform::on_clipboard_grab(uint32_t *types, uint32_t type_count)
if (!OpenClipboard(platform_win)) {
return false;
}
- clipboard_changer = true;
EmptyClipboard();
SetClipboardData(format, NULL);
CloseClipboard();