[Spice-devel] [PATCH spice-gtk v4 3/3] spice-gtk-session: add auto-keyboard-sync property
Pavel Grunt
pgrunt at redhat.com
Fri Nov 14 04:20:12 PST 2014
The property is used to enable sending client's keyboard
description to the guest.
---
gtk/spice-gtk-session.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index 60cf899..d955252 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -64,6 +64,7 @@ struct _SpiceGtkSessionPrivate {
gboolean auto_usbredir_enable;
int auto_usbredir_reqs;
gboolean pointer_grabbed;
+ gboolean auto_keyboard_sync_enable;
};
/**
@@ -117,6 +118,7 @@ enum {
PROP_AUTO_CLIPBOARD,
PROP_AUTO_USBREDIR,
PROP_POINTER_GRABBED,
+ PROP_AUTO_KEYBOARD_SYNC,
};
static guint32 get_keyboard_lock_modifiers(void)
@@ -325,6 +327,9 @@ static void spice_gtk_session_get_property(GObject *gobject,
case PROP_POINTER_GRABBED:
g_value_set_boolean(value, s->pointer_grabbed);
break;
+ case PROP_AUTO_KEYBOARD_SYNC:
+ g_value_set_boolean(value, s->auto_keyboard_sync_enable);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
break;
@@ -372,6 +377,9 @@ static void spice_gtk_session_set_property(GObject *gobject,
}
break;
}
+ case PROP_AUTO_KEYBOARD_SYNC:
+ s->auto_keyboard_sync_enable = g_value_get_boolean(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
break;
@@ -460,6 +468,23 @@ static void spice_gtk_session_class_init(SpiceGtkSessionClass *klass)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * SpiceGtkSession:auto-keyboard-sync:
+ *
+ * Automatically send the keyboard description to the guest
+ *
+ * Since: 0.27
+ **/
+ g_object_class_install_property
+ (gobject_class, PROP_AUTO_KEYBOARD_SYNC,
+ g_param_spec_boolean("auto-keyboard-sync",
+ "Auto keyboard synchronization",
+ "Automatically send the keyboard description to the guest",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
g_type_class_add_private(klass, sizeof(SpiceGtkSessionPrivate));
}
@@ -1257,6 +1282,9 @@ void spice_gtk_session_sync_keyboard_layout(SpiceGtkSession *self)
gchar *keyboard_description;
gboolean agent_connected;
+ if (!s->auto_keyboard_sync_enable)
+ return;
+
keyboard_description = get_keyboard_description();
if (keyboard_description == NULL)
return;
--
1.9.3
More information about the Spice-devel
mailing list