summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2010-10-06 16:35:55 +0200
committerArnon Gilboa <agilboa@redhat.com>2010-10-06 16:35:55 +0200
commitd9c16de42956abe76a7c7710346abde2740093ab (patch)
treefb9568e1f75e839b6f218090f485e439d65a0fd3
parentf58826a83f84d95d50a761835d7d716d7a939391 (diff)
vdagent: remove clipboard_changer hack
Instead of keeping a flag, we simply check wether the new owner is usor not
-rw-r--r--vdagent/vdagent.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 32ad102..6c5f73a 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -83,7 +83,6 @@ private:
static VDAgent* _singleton;
HWND _hwnd;
HWND _hwnd_next_viewer;
- bool _clipboard_changer;
int _clipboard_owner;
DWORD _buttons_state;
LONG _mouse_x;
@@ -128,7 +127,6 @@ VDAgent* VDAgent::get()
VDAgent::VDAgent()
: _hwnd (NULL)
, _hwnd_next_viewer (NULL)
- , _clipboard_changer (true)
, _clipboard_owner (owner_none)
, _buttons_state (0)
, _mouse_x (0)
@@ -875,7 +873,6 @@ bool VDAgent::handle_clipboard_grab(VDAgentClipboardGrab* clipboard_grab)
if (!OpenClipboard(_hwnd)) {
return false;
}
- _clipboard_changer = true;
EmptyClipboard();
SetClipboardData(format, NULL);
CloseClipboard();
@@ -1199,12 +1196,13 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
}
break;
case WM_DRAWCLIPBOARD:
- if (!a->_clipboard_changer) {
+ if (a->_hwnd != GetClipboardOwner()) {
+ a->set_clipboard_owner(a->owner_none);
a->on_clipboard_grab();
- } else {
- a->_clipboard_changer = false;
}
- SendMessage(a->_hwnd_next_viewer, message, wparam, lparam);
+ if (a->_hwnd_next_viewer) {
+ SendMessage(a->_hwnd_next_viewer, message, wparam, lparam);
+ }
break;
case WM_RENDERFORMAT:
a->on_clipboard_request((UINT)wparam);