Re: [PATCH spice-gtk 4/5] gtk: Avoid deprecated gdk_pointer_grab

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> ---
>  src/spice-widget.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index cedc358..17cda84 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1015,6 +1015,18 @@ static gboolean do_pointer_grab(SpiceDisplay *display)
>  #endif
>  
>      try_keyboard_grab(display);
> +#if GTK_CHECK_VERSION(3, 20, 0)
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> +    status = gdk_seat_grab(spice_display_get_default_seat(display),
> +                           window,
> +                           GDK_SEAT_CAPABILITY_ALL_POINTING,
> +                           TRUE,
> +                           blank,
> +                           NULL,
> +                           NULL,
> +                           NULL);
> +    G_GNUC_END_IGNORE_DEPRECATIONS
> +#else
>      /*
>       * from gtk-vnc:
>       * For relative mouse to work correctly when grabbed we need to
> @@ -1024,8 +1036,6 @@ static gboolean do_pointer_grab(SpiceDisplay *display)
>       * what window the pointer is actally over, so use 'FALSE' for
>       * 'owner_events' parameter
>       */
> -    /* FIXME: gdk_pointer_grab() is deprecated */
> -    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      status = gdk_pointer_grab(window, FALSE,
>                       GDK_POINTER_MOTION_MASK |
>                       GDK_BUTTON_PRESS_MASK |

This will cause the warning using Gdk between 3.0 and 3.20 (not inclusive).

> @@ -1035,7 +1045,7 @@ static gboolean do_pointer_grab(SpiceDisplay *display)
>                       NULL,
>                       blank,
>                       GDK_CURRENT_TIME);
> -    G_GNUC_END_IGNORE_DEPRECATIONS
> +#endif
>      grab_successful = (status == GDK_GRAB_SUCCESS);
>      if (!grab_successful) {
>          d->mouse_grab_active = false;
> @@ -1138,9 +1148,6 @@ static void mouse_wrap(SpiceDisplay *display,
> GdkEventMotion *motion)
>  
>  }
>  
> -/* FIXME: gdk_pointer_ungrab()/gdk_display_warp_pointer() are deprecated */
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> -
>  static void try_mouse_ungrab(SpiceDisplay *display)
>  {
>      SpiceDisplayPrivate *d = display->priv;
> @@ -1150,7 +1157,13 @@ static void try_mouse_ungrab(SpiceDisplay *display)
>      if (!d->mouse_grab_active)
>          return;
>  
> +#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_pointer_ungrab(GDK_CURRENT_TIME);
> +#endif
>      gtk_grab_remove(GTK_WIDGET(display));
>  #ifdef G_OS_WIN32
>      ClipCursor(NULL);
> @@ -1173,7 +1186,6 @@ static void try_mouse_ungrab(SpiceDisplay *display)
>      g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false);
>      spice_gtk_session_set_pointer_grabbed(d->gtk_session, false);
>  }
> -G_GNUC_END_IGNORE_DEPRECATIONS
>  
>  static void update_mouse_grab(SpiceDisplay *display)
>  {

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]