summaryrefslogtreecommitdiff
path: root/gtk/spice-gtk-session.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-01-31 23:03:22 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-01-31 23:23:22 +0100
commit5f39af6b88407752984dbf6f8943408e790d2f21 (patch)
tree934d87666b326244e9d4bbfc469f6e468899689c /gtk/spice-gtk-session.c
parentaaed1f583fe8e502f63869cfc0b801823de90878 (diff)
Do not grab/release the clipboard on guest without clipboard support
Add an agent capability check before calling those functions from gtk-session. Avoid extra warnings.
Diffstat (limited to 'gtk/spice-gtk-session.c')
-rw-r--r--gtk/spice-gtk-session.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index e4a36d1..f77296d 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -478,7 +478,9 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
}
if (!s->clip_grabbed[selection] && t > 0) {
s->clip_grabbed[selection] = TRUE;
- spice_main_clipboard_selection_grab(s->main, selection, types, t);
+
+ if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND))
+ spice_main_clipboard_selection_grab(s->main, selection, types, t);
/* Sending a grab causes the agent to do an impicit release */
s->nclip_targets[selection] = 0;
}
@@ -502,7 +504,8 @@ static void clipboard_owner_change(GtkClipboard *clipboard,
if (s->clip_grabbed[selection]) {
s->clip_grabbed[selection] = FALSE;
- spice_main_clipboard_selection_release(s->main, selection);
+ if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND))
+ spice_main_clipboard_selection_release(s->main, selection);
}
switch (event->reason) {