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/platform.h | |
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/platform.h')
-rw-r--r-- | client/platform.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/client/platform.h b/client/platform.h index ff6f38d2..af4a0f6c 100644 --- a/client/platform.h +++ b/client/platform.h @@ -125,6 +125,14 @@ public: static bool on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t size); static bool on_clipboard_request(uint32_t type); static void on_clipboard_release(); + + enum { owner_none, owner_guest, owner_client }; + + static void set_clipboard_owner(int new_owner); + static int get_clipboard_owner() { return _clipboard_owner; } + +private: + static int _clipboard_owner; }; class Platform::EventListener { @@ -141,6 +149,7 @@ public: virtual void on_clipboard_grab(uint32_t *types, uint32_t type_count) = 0; virtual void on_clipboard_request(uint32_t type) = 0; virtual void on_clipboard_notify(uint32_t type, uint8_t* data, int32_t size) = 0; + virtual void on_clipboard_release() = 0; }; class Platform::RecordClient { |