summaryrefslogtreecommitdiff
path: root/gtk/spice-session.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-11-15 16:27:04 +0100
committerHans de Goede <hdegoede@redhat.com>2011-11-21 15:30:38 +0100
commit40cae5011adb79489f7425f02c4c660623fe2b7a (patch)
treeb84e2cadae3d7542b8c197e2b90a9e1553f3f8d1 /gtk/spice-session.c
parent2161b5464fa8ad995ce6116f78aacb4c2389af55 (diff)
Release our keyboard grab when we're going to invoke the usb acl helper
The usb acl helper asks policykit, which may want to interact with the user through the policykit agent, which wants to grab the keyboard, if we then have the keyboard grabbed, the agent says authentication has failed, policykit rejects the helper opening up the acl and usbredir won't work. Unfortunately the only way to work around this is to temporarily release our own keyboard grab, not pretty but as discussed on irc, this is the "best" solution. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'gtk/spice-session.c')
-rw-r--r--gtk/spice-session.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 8fd98c1..3366b58 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -96,6 +96,7 @@ enum {
PROP_SMARTCARD_CERTIFICATES,
PROP_SMARTCARD_DB,
PROP_USBREDIR,
+ PROP_INHIBIT_KEYBOARD_GRAB,
PROP_DISABLE_EFFECTS,
PROP_COLOR_DEPTH,
};
@@ -360,6 +361,9 @@ static void spice_session_get_property(GObject *gobject,
case PROP_USBREDIR:
g_value_set_boolean(value, s->usbredir);
break;
+ case PROP_INHIBIT_KEYBOARD_GRAB:
+ g_value_set_boolean(value, s->inhibit_keyboard_grab);
+ break;
case PROP_DISABLE_EFFECTS:
g_value_set_boxed(value, s->disable_effects);
break;
@@ -452,6 +456,9 @@ static void spice_session_set_property(GObject *gobject,
case PROP_USBREDIR:
s->usbredir = g_value_get_boolean(value);
break;
+ case PROP_INHIBIT_KEYBOARD_GRAB:
+ s->inhibit_keyboard_grab = g_value_get_boolean(value);
+ break;
case PROP_DISABLE_EFFECTS:
g_strfreev(s->disable_effects);
s->disable_effects = g_value_dup_boxed(value);
@@ -798,6 +805,24 @@ static void spice_session_class_init(SpiceSessionClass *klass)
G_PARAM_STATIC_STRINGS));
/**
+ * SpiceSession::inhibit-keyboard-grab
+ *
+ * This boolean is set by the usbredir channel to indicate to #SpiceDisplay
+ * that the keyboard grab should be temporarily released, because it is
+ * going to invoke policykit. It will get reset when the usbredir channel
+ * is done with polickit.
+ *
+ * Since: 0.8
+ **/
+ g_object_class_install_property
+ (gobject_class, PROP_INHIBIT_KEYBOARD_GRAB,
+ g_param_spec_boolean("inhibit-keyboard-grab",
+ "Inhibit Keyboard Grab",
+ "Request that SpiceDisplays don't grab the keyboard",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
* SpiceSession::channel-new:
* @session: the session that emitted the signal
* @channel: the new #SpiceChannel