[Spice-devel] [PATCH spice-gtk] Remove deprecation blocks not needed anymore

Victor Toso victortoso at redhat.com
Wed Jul 25 10:30:39 UTC 2018


Hi,

On Wed, Jul 25, 2018 at 10:27:37AM +0100, Frediano Ziglio wrote:
> Some deprecation blocks in the code were there to avoid warning
> when using too recent GTK functions.

and Glib functions too. Some/most of the checks were from glib
functions that could have been removed since glib bump in
b312ca0809a

> Now that we bump GTK version remove these warning avoidance.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  src/channel-webdav.c   |  6 ------
>  src/giopipe.c          |  2 --
>  src/spice-widget-egl.c |  3 ---
>  src/spice-widget.c     | 17 -----------------
>  4 files changed, 28 deletions(-)
> 
> diff --git a/src/channel-webdav.c b/src/channel-webdav.c
> index 79e3f33..8e4db1a 100644
> --- a/src/channel-webdav.c
> +++ b/src/channel-webdav.c
> @@ -314,9 +314,7 @@ static void demux_to_client_cb(GObject *source, GAsyncResult *result, gpointer u
>      gboolean fail;
>      gsize size;
>  
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      g_output_stream_write_all_finish(G_OUTPUT_STREAM(source), result, &size, &error);
> -G_GNUC_END_IGNORE_DEPRECATIONS

Like those, glib

>  
>      if (error) {
>          CHANNEL_DEBUG(client->self, "write failed: %s", error->message);
> @@ -338,11 +336,9 @@ static void demux_to_client(Client *client)
>      CHANNEL_DEBUG(client->self, "pushing %"G_GSIZE_FORMAT" to client %p", size, client);
>  
>      if (size > 0) {
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          g_output_stream_write_all_async(g_io_stream_get_output_stream(client->pipe),
>                                          c->demux.buf, size, G_PRIORITY_DEFAULT,
>                                          c->cancellable, demux_to_client_cb, client);
> -G_GNUC_END_IGNORE_DEPRECATIONS
>          return;
>      } else {
>          /* Nothing to write */
> @@ -377,9 +373,7 @@ static void start_client(SpiceWebdavChannel *self)
>      client->cancellable = g_cancellable_new();
>      spice_make_pipe(&client->pipe, &peer);
>  
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      addr = g_inet_socket_address_new_from_string ("127.0.0.1", 0);
> -G_GNUC_END_IGNORE_DEPRECATIONS
>      if (!soup_server_accept_iostream(server, peer, addr, addr, &error))
>          goto fail;
>  
> diff --git a/src/giopipe.c b/src/giopipe.c
> index c653cb8..de1adae 100644
> --- a/src/giopipe.c
> +++ b/src/giopipe.c
> @@ -482,10 +482,8 @@ spice_make_pipe(GIOStream **p1, GIOStream **p2)
>      make_gio_pipe(&in1, &out2);
>      make_gio_pipe(&in2, &out1);
>  
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      *p1 = g_simple_io_stream_new(in1, out1);
>      *p2 = g_simple_io_stream_new(in2, out2);
> -G_GNUC_END_IGNORE_DEPRECATIONS
>  
>      g_object_unref(in1);
>      g_object_unref(in2);
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index a6805dd..011d8c7 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -312,12 +312,9 @@ gl_make_current(SpiceDisplay *display, GError **err)
>      else
>  #endif
>      {
> -        /* Ignore GLib's too-new warnings */
> -        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          GtkWidget *area = gtk_stack_get_child_by_name(d->stack, "gl-area");
>  
>          gtk_gl_area_make_current(GTK_GL_AREA(area));
> -        G_GNUC_END_IGNORE_DEPRECATIONS
>      }
>  
>      return TRUE;
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index fdb09a5..80be8d4 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -574,8 +574,6 @@ static void grab_notify(SpiceDisplay *display, gboolean was_grabbed)
>  }
>  
>  #if HAVE_EGL
> -/* Ignore GLib's too-new warnings */
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>  static gboolean
>  gl_area_render(GtkGLArea *area, GdkGLContext *context, gpointer user_data)
>  {
> @@ -607,7 +605,6 @@ gl_area_realize(GtkGLArea *area, gpointer user_data)
>          g_clear_error(&err);
>      }
>  }
> -G_GNUC_END_IGNORE_DEPRECATIONS
>  #endif
>  
>  static void
> @@ -643,8 +640,6 @@ static void spice_display_init(SpiceDisplay *display)
>      gtk_stack_set_visible_child(d->stack, area);
>  
>  #if HAVE_EGL
> -/* Ignore GLib's too-new warnings */
> -G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      area = gtk_gl_area_new();
>      gtk_gl_area_set_required_version(GTK_GL_AREA(area), 3, 2);
>      gtk_gl_area_set_auto_render(GTK_GL_AREA(area), false);
> @@ -653,7 +648,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>                       "signal::realize", gl_area_realize, display,
>                       NULL);
>      gtk_stack_add_named(d->stack, area, "gl-area");
> -G_GNUC_END_IGNORE_DEPRECATIONS
>  #endif
>      area = gtk_drawing_area_new();
>      gtk_stack_add_named(d->stack, area, "gst-area");
> @@ -811,9 +805,7 @@ static GdkSeat *spice_display_get_default_seat(SpiceDisplay *display)
>  {
>      GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
>      GdkDisplay *gdk_display = gdk_window_get_display(window);
> -    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      return gdk_display_get_default_seat(gdk_display);
> -    G_GNUC_END_IGNORE_DEPRECATIONS
>  }
>  
>  /* FIXME: gdk_keyboard_grab/ungrab() is deprecated */
> @@ -880,12 +872,10 @@ static void try_keyboard_grab(SpiceDisplay *display)
>  
>  static void ungrab_keyboard(G_GNUC_UNUSED SpiceDisplay *display)
>  {
> -    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      /* we want to ungrab just the keyboard - it is not possible using gdk_seat_ungrab().
>         See also https://bugzilla.gnome.org/show_bug.cgi?id=780133 */
>      GdkDevice *keyboard = gdk_seat_get_keyboard(spice_display_get_default_seat(display));
>      gdk_device_ungrab(keyboard, GDK_CURRENT_TIME);
> -    G_GNUC_END_IGNORE_DEPRECATIONS

I'm surprised to not see a warning here in gdk_device_ungrab() as
this was deprecated in favor of gdk_seat_ungrab(). Considering
the comment above, I would keep this till we sort out the best
approach on ungrabbing only one device instead of whole seat set
of devices

+ commit log to include glib
+ keep this one above around gdk_device_ungrab()

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

>  }
>  
>  static void try_keyboard_ungrab(SpiceDisplay *display)
> @@ -1026,7 +1016,6 @@ static gboolean do_pointer_grab(SpiceDisplay *display)
>  #endif
>  
>      try_keyboard_grab(display);
> -    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      status = gdk_seat_grab(spice_display_get_default_seat(display),
>                             window,
>                             GDK_SEAT_CAPABILITY_ALL_POINTING,
> @@ -1035,7 +1024,6 @@ static gboolean do_pointer_grab(SpiceDisplay *display)
>                             NULL,
>                             NULL,
>                             NULL);
> -    G_GNUC_END_IGNORE_DEPRECATIONS
>      grab_successful = (status == GDK_GRAB_SUCCESS);
>      if (!grab_successful) {
>          d->mouse_grab_active = false;
> @@ -2400,9 +2388,7 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
>  static GdkDevice *spice_gdk_window_get_pointing_device(GdkWindow *window)
>  {
>      GdkDisplay *gdk_display = gdk_window_get_display(window);
> -    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      return gdk_seat_get_pointer(gdk_display_get_default_seat(gdk_display));
> -    G_GNUC_END_IGNORE_DEPRECATIONS
>  }
>  
>  static GdkModifierType spice_display_get_modifiers_state(SpiceDisplay *display)
> @@ -2909,10 +2895,7 @@ static void gl_draw(SpiceDisplay *display,
>      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 {
>          spice_egl_update_display(display);
> -- 
> 2.17.1
> 
> _______________________________________________
> 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: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180725/16bbe591/attachment-0001.sig>


More information about the Spice-devel mailing list