[virt-tools-list] [PATCH virt-viewer] Disable deprecation warnings for gtk_window_fullscreen_on_monitor

Eduardo Lima (Etrunko) etrunko at redhat.com
Tue Feb 12 19:34:44 UTC 2019


On 2/12/19 12:36 PM, Daniel P. Berrangé wrote:
> We use GLIB_VERSION_MAX_ALLOWED to prevent use of functions from
> GTK >= 3.12. When we do conditional compilation based on a GTK
> version check, we must thus suppress the warning:
> 
>   CC       libvirt_viewer_la-virt-viewer-window.lo
> ../../src/virt-viewer-window.c: In function 'virt_viewer_window_enter_fullscreen':
> ../../src/virt-viewer-window.c:608:9: error: 'gtk_window_fullscreen_on_monitor' is deprecated: Not available before 3.18 [-Werror=deprecated-declarations]
>          gtk_window_fullscreen_on_monitor(GTK_WINDOW(priv->window),
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/gtk-3.0/gtk/gtkdialog.h:32,
>                  from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30,
>                  from /usr/include/gtk-3.0/gtk/gtk.h:31,
>                  from ../../src/virt-viewer-window.c:28:
> /usr/include/gtk-3.0/gtk/gtkwindow.h:391:10: note: declared here
>  void     gtk_window_fullscreen_on_monitor(GtkWindow *window,
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
> 
> Pushed as a build breaker fix
> 
>  src/virt-viewer-window.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index a7b2deb..d3e0fcf 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -605,8 +605,11 @@ virt_viewer_window_enter_fullscreen(VirtViewerWindow *self, gint monitor)
>          // just go fullscreen on the current monitor
>          gtk_window_fullscreen(GTK_WINDOW(priv->window));
>      } else {
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
>          gtk_window_fullscreen_on_monitor(GTK_WINDOW(priv->window),
>                                           gdk_screen_get_default(), monitor);
> +#pragma GCC diagnostic pop
>      }
>  #else
>          gtk_window_fullscreen(GTK_WINDOW(priv->window));
> 

I think it ould better to use
G_P{BEGIN,END}_IGNORE_DEPRECATED_DECLARATIONS instead.


diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 648e769..1fd1c47 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -600,8 +600,10 @@
virt_viewer_window_enter_fullscreen(VirtViewerWindow *self, gint monitor)
         // just go fullscreen on the current monitor
         gtk_window_fullscreen(GTK_WINDOW(priv->window));
     } else {
+G_BEGIN_IGNORE_DEPRECATED_DECLARATIONS
         gtk_window_fullscreen_on_monitor(GTK_WINDOW(priv->window),
                                          gdk_screen_get_default(),
monitor);
+G_END_IGNORE_DEPRECATED_DECLARATIONS
     }
 #else
         gtk_window_fullscreen(GTK_WINDOW(priv->window));



-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com




More information about the virt-tools-list mailing list