[spice-gtk,v2,7/7] gtk-session: remove extra clipboard selection check

Submitted by Victor Toso on Dec. 10, 2018, 11:02 a.m.

Details

Message ID 20181210110256.20115-8-victortoso@redhat.com
State New
Headers show
Series "small code improvements on clipboard" ( rev: 1 ) in Spice

Browsing this patch as part of:
"small code improvements on clipboard" rev 1 in Spice
<< prev patch [7/7] next patch >>

Commit Message

Victor Toso Dec. 10, 2018, 11:02 a.m.
From: Victor Toso <me@victortoso.com>

Commit 284c1f2d switched to
spice_main_channel_clipboard_selection_release() which does check if
agent is connected and does the right thing (expected) in regards to
releasing the clipboard by calling agent_clipboard_release() which
does check VD_AGENT_CAP_CLIPBOARD_SELECTION (like current removed
code).

So this patch removes redundant check.

Same goes for spice_main_channel_clipboard_selection_grab() function.

Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 src/spice-gtk-session.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 373d11e..c7e6e24 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -610,9 +610,7 @@  static void clipboard_get_targets(GtkClipboard *clipboard,
     }
 
     s->clip_grabbed[selection] = TRUE;
-
-    if (spice_main_channel_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND))
-        spice_main_channel_clipboard_selection_grab(s->main, selection, types, num_types);
+    spice_main_channel_clipboard_selection_grab(s->main, selection, types, num_types);
 
     /* Sending a grab causes the agent to do an implicit release */
     s->nclip_targets[selection] = 0;
@@ -636,8 +634,7 @@  static void clipboard_owner_change(GtkClipboard        *clipboard,
 
     if (s->clip_grabbed[selection]) {
         s->clip_grabbed[selection] = FALSE;
-        if (spice_main_channel_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND))
-            spice_main_channel_clipboard_selection_release(s->main, selection);
+        spice_main_channel_clipboard_selection_release(s->main, selection);
     }
 
     switch (event->reason) {