> > --- > src/spice-widget.c | 26 ++++++++++++++++++++++---- > 1 file changed, 22 insertions(+), 4 deletions(-) > > diff --git a/src/spice-widget.c b/src/spice-widget.c > index a3d6526..cedc358 100644 > --- a/src/spice-widget.c > +++ b/src/spice-widget.c > @@ -119,6 +119,9 @@ static void release_keys(SpiceDisplay *display); > static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer > data); > static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data); > static void update_size_request(SpiceDisplay *display); > +#if GTK_CHECK_VERSION(3, 20, 0) > +static GdkSeat *spice_display_get_default_seat(SpiceDisplay *display); > +#endif > > /* ---------------------------------------------------------------- */ > > @@ -811,9 +814,6 @@ SpiceGrabSequence > *spice_display_get_grab_keys(SpiceDisplay *display) > return d->grabseq; > } > > -/* FIXME: gdk_keyboard_grab/ungrab() is deprecated */ > -G_GNUC_BEGIN_IGNORE_DEPRECATIONS > - > static void try_keyboard_grab(SpiceDisplay *display) > { > GtkWidget *widget = GTK_WIDGET(display); > @@ -849,8 +849,21 @@ static void try_keyboard_grab(SpiceDisplay *display) > GetModuleHandle(NULL), 0); > g_warn_if_fail(d->keyboard_hook != NULL); > #endif > +#if GTK_CHECK_VERSION(3, 20, 0) > + G_GNUC_BEGIN_IGNORE_DEPRECATIONS The ignore deprecations should be on older code, not new one. > + status = gdk_seat_grab(spice_display_get_default_seat(display), > + gtk_widget_get_window(widget), > + GDK_SEAT_CAPABILITY_KEYBOARD, > + FALSE, > + NULL, > + NULL, > + NULL, > + NULL); > + G_GNUC_END_IGNORE_DEPRECATIONS > +#else > status = gdk_keyboard_grab(gtk_widget_get_window(widget), FALSE, > GDK_CURRENT_TIME); > +#endif > if (status != GDK_GRAB_SUCCESS) { > g_warning("keyboard grab failed %u", status); > d->keyboard_grab_active = false; > @@ -869,7 +882,13 @@ static void try_keyboard_ungrab(SpiceDisplay *display) > return; > > SPICE_DEBUG("ungrab keyboard"); > +#if GTK_CHECK_VERSION(3, 20, 0) > + G_GNUC_BEGIN_IGNORE_DEPRECATIONS > + gdk_seat_ungrab(spice_display_get_default_seat(display)); > + G_GNUC_END_IGNORE_DEPRECATIONS > +#else > gdk_keyboard_ungrab(GDK_CURRENT_TIME); > +#endif I would prefer something like glib-compat.h in spice-server. > #ifdef G_OS_WIN32 > // do not use g_clear_pointer as Windows API have different linkage > if (d->keyboard_hook) { > @@ -880,7 +899,6 @@ static void try_keyboard_ungrab(SpiceDisplay *display) > d->keyboard_grab_active = false; > g_signal_emit(widget, signals[SPICE_DISPLAY_KEYBOARD_GRAB], 0, false); > } > -G_GNUC_END_IGNORE_DEPRECATIONS > > > static void update_keyboard_grab(SpiceDisplay *display) Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel