[Spice-devel] [PATCH spice-gtk v3 5/6] gtk: Avoid deprecated gdk_pointer_grab

Victor Toso victortoso at redhat.com
Mon Jan 23 13:52:18 UTC 2017


Hi,

On Fri, Jan 20, 2017 at 04:53:52PM +0100, Pavel Grunt wrote:
> ---
>  src/spice-widget.c | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index aa03556..9d5ac3d 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1023,6 +1023,17 @@ static gboolean do_pointer_grab(SpiceDisplay *display)
>  #endif
>  
>      try_keyboard_grab(display);
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> +#if GTK_CHECK_VERSION(3, 20, 0)
> +    status = gdk_seat_grab(spice_display_get_default_seat(display),
> +                           window,
> +                           GDK_SEAT_CAPABILITY_ALL_POINTING,
> +                           TRUE,
> +                           blank,
> +                           NULL,
> +                           NULL,
> +                           NULL);
> +#else
>      /*
>       * from gtk-vnc:
>       * For relative mouse to work correctly when grabbed we need to
> @@ -1032,8 +1043,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 |
> @@ -1043,6 +1052,7 @@ static gboolean do_pointer_grab(SpiceDisplay *display)
>                       NULL,
>                       blank,
>                       GDK_CURRENT_TIME);
> +#endif
>      G_GNUC_END_IGNORE_DEPRECATIONS
>      grab_successful = (status == GDK_GRAB_SUCCESS);
>      if (!grab_successful) {
> @@ -1142,9 +1152,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;
> @@ -1154,7 +1161,13 @@ 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

Looks good
Acked-by: Victor Toso <victortoso at redhat.com>

>      gtk_grab_remove(GTK_WIDGET(display));
>  #ifdef G_OS_WIN32
>      ClipCursor(NULL);
> @@ -1177,7 +1190,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)
>  {
> -- 
> 2.11.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170123/4ca79e62/attachment.sig>


More information about the Spice-devel mailing list