summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2010-11-23 18:40:20 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2010-11-24 02:53:59 +0100
commit7bb0a0e9c7c3b2780e93767927d622eed9a3b823 (patch)
tree927f02f2e7439d1a54501f992013c868590fca0c
parentdd6a9e692e99bdbf006ec7fbc0d34aa85a5cc55b (diff)
downloadspice-gtk-7bb0a0e9c7c3b2780e93767927d622eed9a3b823.tar.gz
spice-gtk-7bb0a0e9c7c3b2780e93767927d622eed9a3b823.tar.xz
spice-gtk-7bb0a0e9c7c3b2780e93767927d622eed9a3b823.zip
gtk: ensure we sync key locks after connection
-rw-r--r--gtk/channel-inputs.c21
-rw-r--r--gtk/spice-widget.c2
2 files changed, 21 insertions, 2 deletions
diff --git a/gtk/channel-inputs.c b/gtk/channel-inputs.c
index a411804..13e35bc 100644
--- a/gtk/channel-inputs.c
+++ b/gtk/channel-inputs.c
@@ -28,6 +28,7 @@ struct spice_inputs_channel {
unsigned int x, y, dpy;
int motion_count;
int modifiers;
+ guint32 locks;
};
G_DEFINE_TYPE(SpiceInputsChannel, spice_inputs_channel, SPICE_TYPE_CHANNEL)
@@ -48,6 +49,7 @@ enum {
static guint signals[SPICE_INPUTS_LAST_SIGNAL];
static void spice_inputs_handle_msg(SpiceChannel *channel, spice_msg_in *msg);
+static void spice_inputs_channel_up(SpiceChannel *channel);
/* ------------------------------------------------------------------ */
@@ -90,6 +92,7 @@ static void spice_inputs_channel_class_init(SpiceInputsChannelClass *klass)
gobject_class->finalize = spice_inputs_channel_finalize;
gobject_class->get_property = spice_inputs_get_property;
channel_class->handle_msg = spice_inputs_handle_msg;
+ channel_class->channel_up = spice_inputs_channel_up;
g_object_class_install_property
(gobject_class, PROP_KEY_MODIFIERS,
@@ -360,8 +363,17 @@ void spice_inputs_set_key_locks(SpiceInputsChannel *channel, guint locks)
{
SpiceMsgcKeyModifiers modifiers;
spice_msg_out *msg;
+ spice_inputs_channel *ic;
+ spice_channel *c;
- g_return_if_fail(channel != NULL);
+ g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(channel));
+
+ ic = channel->priv;
+ c = SPICE_CHANNEL(channel)->priv;
+
+ ic->locks = locks;
+ if (c->state != SPICE_CHANNEL_STATE_READY)
+ return;
msg = spice_msg_out_new(SPICE_CHANNEL(channel),
SPICE_MSGC_INPUTS_KEY_MODIFIERS);
@@ -370,3 +382,10 @@ void spice_inputs_set_key_locks(SpiceInputsChannel *channel, guint locks)
spice_msg_out_send(msg);
spice_msg_out_unref(msg);
}
+
+static void spice_inputs_channel_up(SpiceChannel *channel)
+{
+ spice_inputs_channel *c = SPICE_INPUTS_CHANNEL(channel)->priv;
+
+ spice_inputs_set_key_locks(SPICE_INPUTS_CHANNEL(channel), c->locks);
+}
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 10d3a49..b84a321 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -389,7 +389,6 @@ static void spice_sync_keyboard_lock_modifiers(SpiceDisplay *display)
modifiers = get_keyboard_lock_modifiers(x_display);
if (d->inputs)
spice_inputs_set_key_locks(d->inputs, modifiers);
- spice_set_keyboard_lock_modifiers(display, modifiers);
}
void spice_display_set_grab_keys(SpiceDisplay *display, VncGrabSequence *seq)
@@ -1585,6 +1584,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
if (SPICE_IS_INPUTS_CHANNEL(channel)) {
d->inputs = SPICE_INPUTS_CHANNEL(channel);
spice_channel_connect(channel);
+ spice_sync_keyboard_lock_modifiers(display);
return;
}