diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-04-06 12:02:00 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-04-08 13:29:55 +0200 |
commit | 38f8fab50846369e0d6e7e427316bf2ce1fb76ec (patch) | |
tree | 0d4f7ff888ac9755d1360945f319d2735cada650 | |
parent | e15ca100b9ef8b5dbce36086f5e210f78b5f2b0d (diff) |
gtk: use a separate var to keep track of self caused new clipboard owner events
Also change 0/1 to FALSE/TRUE in touched code. spice-widget seems to be
using all 3 of: 0/1 false/true and FALSE/TRUE for booleans. The glib convention
is FALSE/TRUE.
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | gtk/spice-widget-priv.h | 3 | ||||
-rw-r--r-- | gtk/spice-widget.c | 11 |
3 files changed, 10 insertions, 5 deletions
@@ -3,4 +3,5 @@ The spice-gtk team would like to thanks the following contributors: Alon Levy <alevy@redhat.com> Christophe Fergeau <cfergeau@redhat.com> Daniel P. Berrange <berrange@redhat.com> +Hans de Goede <hdegoede@redhat.com> Tiziano Mueller <dev-zero@gentoo.org> diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h index 40e0ac1..a57cf66 100644 --- a/gtk/spice-widget-priv.h +++ b/gtk/spice-widget-priv.h @@ -79,7 +79,8 @@ struct spice_display { guint nclip_targets[CLIPBOARD_LAST]; bool clip_hasdata[CLIPBOARD_LAST]; bool clip_grabbed[CLIPBOARD_LAST]; - gboolean clipboard_by_guest[CLIPBOARD_LAST]; /* hack? */ + gboolean clipboard_by_guest[CLIPBOARD_LAST]; + gboolean clipboard_selfgrab_pending[CLIPBOARD_LAST]; SpiceSession *session; SpiceMainChannel *main; diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c index da079a2..e965f84 100644 --- a/gtk/spice-widget.c +++ b/gtk/spice-widget.c @@ -1134,16 +1134,17 @@ static void clipboard_owner_change(GtkClipboard *clipboard, switch (event->reason) { case GDK_OWNER_CHANGE_NEW_OWNER: - if (d->clipboard_by_guest[selection]) { - d->clipboard_by_guest[selection] = FALSE; + if (d->clipboard_selfgrab_pending[selection]) { + d->clipboard_selfgrab_pending[selection] = FALSE; break; } - d->clip_hasdata[selection] = 1; + d->clipboard_by_guest[selection] = FALSE; + d->clip_hasdata[selection] = TRUE; if (d->auto_clipboard_enable) gtk_clipboard_request_targets(clipboard, clipboard_get_targets, data); break; default: - d->clip_hasdata[selection] = 0; + d->clip_hasdata[selection] = FALSE; break; } } @@ -1616,6 +1617,7 @@ static gboolean clipboard_grab(SpiceMainChannel *main, guint selection, g_warning("clipboard grab failed"); return FALSE; } + d->clipboard_selfgrab_pending[selection] = TRUE; skip_grab_clipboard: d->clipboard_by_guest[selection] = TRUE; @@ -1866,6 +1868,7 @@ void spice_display_paste_from_guest(SpiceDisplay *display) g_warning("Clipboard grab failed"); return; } + d->clipboard_selfgrab_pending[selection] = TRUE; } /** |