[Spice-devel] [PATCH spice-gtk 1/2] spice-gtk-session: Add sync modifiers property
Pavel Grunt
pgrunt at redhat.com
Fri Feb 3 15:55:33 UTC 2017
Hi,
On Fri, 2017-01-27 at 11:42 +0000, Marc-André Lureau wrote:
> H
>
> On Tue, May 3, 2016 at 5:41 PM Pavel Grunt <pgrunt at redhat.com>
> wrote:
> > It will help in cases where syncing modifiers keys is complicated:
> > * not working leds for modifiers keys
> > * different keyboard layout on the guest side
>
> Since it's only for testing (isn't it?), wouldn't an environment
> variable be a better fit? It would work with any client.
>
one point was to test changing the locking on the fly. The patch was
created to workaround "not working leds in vt"
https://bugzilla.redhat.com/show_bug.cgi?id=1256895
and issues with Japanese keyboard layout.
I think it would be good to set the property if an envar is set - that
way it will work with any client and also allow to do some testing on
the fly.
I understand that is not ideal to add a new public api if it is just
for testing. Maybe we should consider a configure option (like
server's "--enable-statistics") which would extend the library api for
developers use only (could be used for this modifiers sync, preferred
compression and other stuff which are not interesting for user or
which we don't want to have "in the production").
Pavel
> thanks
>
> > ---
> > src/spice-gtk-session.c | 30 ++++++++++++++++++++++++++++++
> > 1 file changed, 30 insertions(+)
> >
> > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > index 27623f0..bbcbeeb 100644
> > --- a/src/spice-gtk-session.c
> > +++ b/src/spice-gtk-session.c
> > @@ -65,6 +65,7 @@ struct _SpiceGtkSessionPrivate {
> > gboolean pointer_grabbed;
> > gboolean keyboard_has_focus;
> > gboolean mouse_has_pointer;
> > + gboolean sync_modifiers;
> > };
> >
> > /**
> > @@ -118,6 +119,7 @@ enum {
> > PROP_AUTO_CLIPBOARD,
> > PROP_AUTO_USBREDIR,
> > PROP_POINTER_GRABBED,
> > + PROP_SYNC_MODIFIERS,
> > };
> >
> > static guint32 get_keyboard_lock_modifiers(void)
> > @@ -185,6 +187,11 @@ static void
> > spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSess
> > io
> >
> > g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(inputs));
> >
> > + if (SPICE_IS_GTK_SESSION(self) && !self->priv-
> > >sync_modifiers) {
> > + SPICE_DEBUG("Syncing modifiers is disabled");
> > + return;
> > + }
> > +
> > g_object_get(inputs, "key-modifiers", &guest_modifiers,
> > NULL);
> > client_modifiers = get_keyboard_lock_modifiers();
> >
> > @@ -332,6 +339,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_SYNC_MODIFIERS:
> > + g_value_set_boolean(value, s->sync_modifiers);
> > + break;
> > default:
> > G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id,
> > pspec);
> > break;
> > @@ -379,6 +389,9 @@ static void
> > spice_gtk_session_set_property(GObject *gobject,
> > }
> > break;
> > }
> > + case PROP_SYNC_MODIFIERS:
> > + s->sync_modifiers = g_value_get_boolean(value);
> > + break;
> > default:
> > G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id,
> > pspec);
> > break;
> > @@ -467,6 +480,23 @@ static void
> > spice_gtk_session_class_init(SpiceGtkSessionClass *klass)
> > G_PARAM_READABLE |
> > G_PARAM_STATIC_STRINGS));
> >
> > + /**
> > + * SpiceGtkSession:sync-modifiers:
> > + *
> > + * Automatically sync modifiers (Caps, Num and Scroll locks)
> > with the guest.
> > + *
> > + * Since: 0.32
> > + **/
> > + g_object_class_install_property
> > + (gobject_class, PROP_SYNC_MODIFIERS,
> > + g_param_spec_boolean("sync-modifiers",
> > + "Sync modifiers",
> > + "Automatically sync modifiers",
> > + TRUE,
> > + G_PARAM_READWRITE |
> > + G_PARAM_CONSTRUCT |
> > + G_PARAM_STATIC_STRINGS));
> > +
> > g_type_class_add_private(klass,
> > sizeof(SpiceGtkSessionPrivate));
> > }
> >
> > --
> > 2.8.2
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
> >
>
> --
> Marc-André Lureau
More information about the Spice-devel
mailing list