[Spice-devel,client,v3,08/10] gtk: Temporarily ignore the keyboard/mouse grabbing deprecation warnings

Submitted by Francois Gouget on Oct. 27, 2016, 4:42 p.m.

Details

Message ID 134640fc28557eaa10a9cb3cd4e22a11c187ed4d.1477585592.git.fgouget@free.fr
State New
Headers show
Series "Deprecation warning cleanup" ( rev: 6 5 ) in Spice

Not browsing as part of any series.

Commit Message

Francois Gouget Oct. 27, 2016, 4:42 p.m.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
---
 src/spice-widget.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 82adacf..f0681d6 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -812,6 +812,9 @@  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);
@@ -878,6 +881,8 @@  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)
 {
@@ -1002,6 +1007,8 @@  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 |
@@ -1011,6 +1018,7 @@  static gboolean do_pointer_grab(SpiceDisplay *display)
                      NULL,
                      blank,
                      GDK_CURRENT_TIME);
+    G_GNUC_END_IGNORE_DEPRECATIONS
     grab_successful = (status == GDK_GRAB_SUCCESS);
     if (!grab_successful) {
         d->mouse_grab_active = false;
@@ -1101,8 +1109,11 @@  static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion)
         /* FIXME: we try our best to ignore that next pointer move event.. */
         gdk_display_sync(gdk_screen_get_display(screen));
 
+        /* FIXME: gdk_display_warp_pointer() is deprecated */
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
         gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)),
                                  screen, xr, yr);
+        G_GNUC_END_IGNORE_DEPRECATIONS
         d->mouse_last_x = -1;
         d->mouse_last_y = -1;
     }
@@ -1110,6 +1121,9 @@  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;
@@ -1142,6 +1156,7 @@  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)
 {
@@ -1985,7 +2000,10 @@  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
         gdk_pointer_ungrab(GDK_CURRENT_TIME);
+        G_GNUC_END_IGNORE_DEPRECATIONS
 
     if (!d->inputs)
         return true;
@@ -2355,7 +2373,10 @@  static void update_mouse_mode(SpiceChannel *channel, gpointer data)
 
         if (window != NULL) {
             GdkModifierType modifiers;
+            /* FIXME: gdk_window_get_pointer() is deprecated */
+            G_GNUC_BEGIN_IGNORE_DEPRECATIONS
             gdk_window_get_pointer(window, NULL, NULL, &modifiers);
+            G_GNUC_END_IGNORE_DEPRECATIONS
 
             if (modifiers & SPICE_GDK_BUTTONS_MASK)
                 try_mouse_grab(display);
@@ -2771,7 +2792,10 @@  static void gl_draw(SpiceDisplay *display,
     GtkWidget *gl = gtk_stack_get_child_by_name(d->stack, "gl-area");
 
     if (gtk_stack_get_visible_child(d->stack) == gl) {
+        /* Ignore GLib's too-new warnings */
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
         gtk_gl_area_queue_render(GTK_GL_AREA(gl));
+        G_GNUC_END_IGNORE_DEPRECATIONS
         d->egl.call_draw_done = TRUE;
     } else
 #endif

Comments

If this is temporary, what's the long-term solution? I assume that the
proper solution is not simple or obvious since then you'd have just
fixed it properly. But I think that if we're committing a 'temporary'
fix, the commit log should have an explanation of why it's temporary
and what the long-term fix is.

Applies to the next commit as well.


On Thu, 2016-10-27 at 18:42 +0200, Francois Gouget wrote:
> Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> ---
>  src/spice-widget.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 82adacf..f0681d6 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -812,6 +812,9 @@ 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);
> @@ -878,6 +881,8 @@ 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)
>  {
> @@ -1002,6 +1007,8 @@ 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 |
> @@ -1011,6 +1018,7 @@ static gboolean do_pointer_grab(SpiceDisplay
> *display)
>                       NULL,
>                       blank,
>                       GDK_CURRENT_TIME);
> +    G_GNUC_END_IGNORE_DEPRECATIONS
>      grab_successful = (status == GDK_GRAB_SUCCESS);
>      if (!grab_successful) {
>          d->mouse_grab_active = false;
> @@ -1101,8 +1109,11 @@ static void mouse_wrap(SpiceDisplay *display,
> GdkEventMotion *motion)
>          /* FIXME: we try our best to ignore that next pointer move
> event.. */
>          gdk_display_sync(gdk_screen_get_display(screen));
>  
> +        /* FIXME: gdk_display_warp_pointer() is deprecated */
> +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(d
> isplay)),
>                                   screen, xr, yr);
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>          d->mouse_last_x = -1;
>          d->mouse_last_y = -1;
>      }
> @@ -1110,6 +1121,9 @@ 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;
> @@ -1142,6 +1156,7 @@ 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)
>  {
> @@ -1985,7 +2000,10 @@ 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
>          gdk_pointer_ungrab(GDK_CURRENT_TIME);
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>  
>      if (!d->inputs)
>          return true;
> @@ -2355,7 +2373,10 @@ static void update_mouse_mode(SpiceChannel
> *channel, gpointer data)
>  
>          if (window != NULL) {
>              GdkModifierType modifiers;
> +            /* FIXME: gdk_window_get_pointer() is deprecated */
> +            G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>              gdk_window_get_pointer(window, NULL, NULL, &modifiers);
> +            G_GNUC_END_IGNORE_DEPRECATIONS
>  
>              if (modifiers & SPICE_GDK_BUTTONS_MASK)
>                  try_mouse_grab(display);
> @@ -2771,7 +2792,10 @@ static void gl_draw(SpiceDisplay *display,
>      GtkWidget *gl = gtk_stack_get_child_by_name(d->stack, "gl-
> area");
>  
>      if (gtk_stack_get_visible_child(d->stack) == gl) {
> +        /* Ignore GLib's too-new warnings */
> +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          gtk_gl_area_queue_render(GTK_GL_AREA(gl));
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>          d->egl.call_draw_done = TRUE;
>      } else
>  #endif
On Fri, 28 Oct 2016, Jonathon Jongsma wrote:

> If this is temporary, what's the long-term solution? I assume that the
> proper solution is not simple or obvious since then you'd have just
> fixed it properly. But I think that if we're committing a 'temporary'
> fix, the commit log should have an explanation of why it's temporary
> and what the long-term fix is.

I'm not familiar with that code or the GDK APIs it uses and I do not 
feel like starting the snowball rolling either (it's rolled far enough 
already as far as I'm concerned). So I don't know what the long term 
solution is.

But as for the other cases, either there's a suitable non-deprecated API 
and we modify our implementation to use it; or we stick to the 
deprecated APIs and add comments explaining why next to the 
XXX_IGNORE_DEPRECATIONS statements.