diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-10-02 16:29:36 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2010-10-02 16:29:36 +0200 |
commit | 8a160078d0852ff5a2f8ec438cec1b18858e3c5d (patch) | |
tree | 05b7cdfb2523242e013e561c8a83a630e4762eaf /client/windows | |
parent | deb849dfd54deafa894692f4e44208c2de9f33aa (diff) | |
download | spice-8a160078d0852ff5a2f8ec438cec1b18858e3c5d.tar.gz spice-8a160078d0852ff5a2f8ec438cec1b18858e3c5d.tar.xz spice-8a160078d0852ff5a2f8ec438cec1b18858e3c5d.zip |
Keep track of clipboard ownership
Given that all clipboard handling is async, it is possible to for
example receive a request for clipboard data from the agent
while the client no longer owns the clipboard (ie a
VD_AGENT_CLIPBOARD_RELEASE message is in transit to the agent).
Thus it is necessary to keep track of our notion of clipboard ownership
and check received clipboard messages (both from other apps on the client
machine and from the agent) to see if they match our notion and if not
drop, or in case were a counter message is expected nack the clipboard
message.
Diffstat (limited to 'client/windows')
-rw-r--r-- | client/windows/platform.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index db6d18ab..db47079d 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -54,6 +54,7 @@ public: virtual void on_clipboard_grab(uint32_t *types, uint32_t type_count) {} virtual void on_clipboard_request(uint32_t type) {} virtual void on_clipboard_notify(uint32_t type, uint8_t* data, int32_t size) {} + virtual void on_clipboard_release() {} }; static DefaultClipboardListener default_clipboard_listener; @@ -856,6 +857,18 @@ void WinPlatform::exit_modal_loop() modal_loop_active = false; } +int Platform::_clipboard_owner = Platform::owner_none; + +void Platform::set_clipboard_owner(int new_owner) +{ + if (new_owner == owner_none) { + clipboard_listener->on_clipboard_release(); + + /* FIXME clear cached clipboard type info and data */ + } + _clipboard_owner = new_owner; +} + bool Platform::on_clipboard_grab(uint32_t *types, uint32_t type_count) { /* FIXME use all types rather then just the first one */ |