Hi Snir, On Wed, 2017-03-22 at 08:26 +0200, Snir Sheriber wrote: > Hi, > > Yep, fixed it:) > > I would prefer to revert both grabbing and ungrabbing to the > deprecated > functions until a suitable I would prefer the current state because the old functions were deprecated before GTK3. And some says that gdk device and seat functions work better in Wayland env. What we could do is to migrate just to gdk_device family, I skipped it because it is deprecated - but gtk itself still uses it. Also my goal is to be able to compile with gtk master and it is not possible with gdk_pointer_ungrab (it's been removed). > > gdk_seat_ungrab function will be available tbh, I don't think it will happen. I didn't get an useful reply when I asked on #gtk+ > but maybe a comment > explaining why seat_ungrab is I can extend the comment in ungrab_pointer() and ungrab_keyboard() helper functions. > > not in use (just to avoid that someone will change it again) will be > be > enough. > > Anyways, Ack. > > Snir. Thanks, Pavel > > > On 03/16/2017 12:42 PM, Pavel Grunt wrote: > > Avoid broken grab (alt+tab not working), regression since > > ef7a6fa1798c8e53c0b77330b398a78181cf90e5 > > > > Currently it is not possible to ungrab just keyboard/mouse > > using GdkSeat functions: > > https://bugzilla.gnome.org/show_bug.cgi?id=780133 > > Use deprecated gdk_device_ungrab to do it > > --- > > src/spice-widget.c | 49 +++++++++++++++++++++++++++++----------- > > --------- > > 1 file changed, 29 insertions(+), 20 deletions(-) > > > > diff --git a/src/spice-widget.c b/src/spice-widget.c > > index 9a7ea56..c7db2a8 100644 > > --- a/src/spice-widget.c > > +++ b/src/spice-widget.c > > @@ -890,6 +890,19 @@ static void try_keyboard_grab(SpiceDisplay > > *display) > > } > > } > > > > +static void ungrab_keyboard(G_GNUC_UNUSED SpiceDisplay *display) > > +{ > > + G_GNUC_BEGIN_IGNORE_DEPRECATIONS > > +#if GTK_CHECK_VERSION(3, 20, 0) > > + /* we want to ungrab just the keyboard - it is possible using > > deprecated gdk_device_ungrab */ > > + GdkDevice *keyboard = > > gdk_seat_get_keyboard(spice_display_get_default_seat(display)); > > + gdk_device_ungrab(keyboard, GDK_CURRENT_TIME); > > +#else > > + gdk_keyboard_ungrab(GDK_CURRENT_TIME); > > +#endif > > + G_GNUC_END_IGNORE_DEPRECATIONS > > +} > > + > > static void try_keyboard_ungrab(SpiceDisplay *display) > > { > > SpiceDisplayPrivate *d = display->priv; > > @@ -899,11 +912,7 @@ static void try_keyboard_ungrab(SpiceDisplay > > *display) > > return; > > > > SPICE_DEBUG("ungrab keyboard"); > > -#if GTK_CHECK_VERSION(3, 20, 0) > > - gdk_seat_ungrab(spice_display_get_default_seat(display)); > > -#else > > - gdk_keyboard_ungrab(GDK_CURRENT_TIME); > > -#endif > > + ungrab_keyboard(display); > > #ifdef G_OS_WIN32 > > // do not use g_clear_pointer as Windows API have different > > linkage > > if (d->keyboard_hook) { > > @@ -1161,6 +1170,19 @@ static void mouse_wrap(SpiceDisplay > > *display, GdkEventMotion *motion) > > > > } > > > > +static void ungrab_pointer(G_GNUC_UNUSED SpiceDisplay *display) > > +{ > > + G_GNUC_BEGIN_IGNORE_DEPRECATIONS > > +#if GTK_CHECK_VERSION(3, 20, 0) > > + /* we want to ungrab just the pointer - it is possible using > > deprecated gdk_device_ungrab */ > > + GdkDevice *pointer = > > gdk_seat_get_pointer(spice_display_get_default_seat(display)); > > + gdk_device_ungrab(pointer, GDK_CURRENT_TIME); > > +#else > > + gdk_pointer_ungrab(GDK_CURRENT_TIME); > > +#endif > > + G_GNUC_END_IGNORE_DEPRECATIONS > > +} > > + > > static void try_mouse_ungrab(SpiceDisplay *display) > > { > > SpiceDisplayPrivate *d = display->priv; > > @@ -1171,13 +1193,7 @@ static void try_mouse_ungrab(SpiceDisplay > > *display) > > if (!d->mouse_grab_active) > > return; > > > > - G_GNUC_BEGIN_IGNORE_DEPRECATIONS > > -#if GTK_CHECK_VERSION(3, 20, 0) > > - gdk_seat_ungrab(spice_display_get_default_seat(display)); > > -#else > > - gdk_pointer_ungrab(GDK_CURRENT_TIME); > > -#endif > > - G_GNUC_END_IGNORE_DEPRECATIONS > > + ungrab_pointer(display); > > gtk_grab_remove(GTK_WIDGET(display)); > > #ifdef G_OS_WIN32 > > ClipCursor(NULL); > > @@ -2044,14 +2060,7 @@ static gboolean button_event(GtkWidget > > *widget, GdkEventButton *button) > > FIXME: should be multiple widget grab, but how? > > or should know the position of the other widgets? > > */ > > - /* FIXME: gdk_pointer_ungrab() is deprecated */ > > - G_GNUC_BEGIN_IGNORE_DEPRECATIONS > > -#if GTK_CHECK_VERSION(3, 20, 0) > > - gdk_seat_ungrab(spice_display_get_default_seat(display)); > > -#else > > - gdk_pointer_ungrab(GDK_CURRENT_TIME); > > -#endif > > - G_GNUC_END_IGNORE_DEPRECATIONS > > + ungrab_pointer(display); > > } > > > > if (!d->inputs) > > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel