diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-10-02 12:46:26 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2010-10-02 15:32:28 +0200 |
commit | 5781c97a1751e8e889b30dcce4641fb30508e072 (patch) | |
tree | 1aba42ec1e1d63120bd0aad3d00cde52de9ab066 /client | |
parent | bc9f00961fa7aaca8d55204ca4fa04abb0f77c8c (diff) | |
download | spice-5781c97a1751e8e889b30dcce4641fb30508e072.tar.gz spice-5781c97a1751e8e889b30dcce4641fb30508e072.tar.xz spice-5781c97a1751e8e889b30dcce4641fb30508e072.zip |
Move checking for on demand clipboard cap closer to sending of agent messages
This way the events will always get generated and other things
(such as clipboard ownership administration, see the next patches)
can be done in repsonse to the events, even though no message will be send.
This patch also removes the !_agent_caps check from the capability
checks, this is not needed as VD_AGENT_HAS_CAPABILITY checks _agent_caps_size
which will be 0 when _agent_caps is NULL.
Diffstat (limited to 'client')
-rw-r--r-- | client/red_client.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/client/red_client.cpp b/client/red_client.cpp index 99e79a50..666de40c 100644 --- a/client/red_client.cpp +++ b/client/red_client.cpp @@ -818,6 +818,13 @@ void RedClient::do_send_agent_clipboard() void RedClient::send_agent_clipboard_message(uint32_t message_type, uint32_t size, void* data) { + if (!_agent_connected) + return; + + if (!VD_AGENT_HAS_CAPABILITY(_agent_caps, _agent_caps_size, + VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) + return; + Message* message = new Message(SPICE_MSGC_MAIN_AGENT_DATA); VDAgentMessage* msg = (VDAgentMessage*) spice_marshaller_reserve_space(message->marshaller(), sizeof(VDAgentMessage) + size); @@ -835,20 +842,12 @@ void RedClient::send_agent_clipboard_message(uint32_t message_type, uint32_t siz void RedClient::on_clipboard_grab(uint32_t *types, uint32_t type_count) { - if (!_agent_caps || !VD_AGENT_HAS_CAPABILITY(_agent_caps, _agent_caps_size, - VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) { - return; - } AutoRef<ClipboardGrabEvent> event(new ClipboardGrabEvent(types, type_count)); get_process_loop().push_event(*event); } void RedClient::on_clipboard_request(uint32_t type) { - if (!_agent_caps || !VD_AGENT_HAS_CAPABILITY(_agent_caps, _agent_caps_size, - VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) { - return; - } AutoRef<ClipboardRequestEvent> event(new ClipboardRequestEvent(type)); get_process_loop().push_event(*event); } @@ -859,6 +858,9 @@ void RedClient::on_clipboard_notify(uint32_t type, uint8_t* data, int32_t size) if (!_agent_connected) { return; } + if (!VD_AGENT_HAS_CAPABILITY(_agent_caps, _agent_caps_size, + VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) + return; if (_agent_out_msg) { DBG(0, "clipboard change is already pending"); return; |