diff mbox

[v2,4/5] gtk: add opengl support, using egl

Message ID 1432645002.24602.9.camel@nilsson.home.kraxel.org
State New
Headers show

Commit Message

Gerd Hoffmann May 26, 2015, 12:56 p.m. UTC
On Di, 2015-05-26 at 08:35 +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> > only). That, or pass -Wno-deprecated-declarations for compiling 
> > ui/gtk.c, but that seems very ugly to me.
> 
> We can also try some #pragma warn dance, to limit the
> -Wno-deprecated-declarations to a small code block.
> 
> We have something simliar already for a bug in the gtk2 headers.

i.e. like this:

Comments

Max Reitz May 26, 2015, 2:06 p.m. UTC | #1
On 26.05.2015 14:56, Gerd Hoffmann wrote:
> On Di, 2015-05-26 at 08:35 +0200, Gerd Hoffmann wrote:
>>    Hi,
>>
>>> only). That, or pass -Wno-deprecated-declarations for compiling
>>> ui/gtk.c, but that seems very ugly to me.
>> We can also try some #pragma warn dance, to limit the
>> -Wno-deprecated-declarations to a small code block.
>>
>> We have something simliar already for a bug in the gtk2 headers.
> i.e. like this:

I don't like it very much, but you're the maintainer, so if you deem it 
acceptable, I won't object. :-)

Google says clang supports GCC pragmas, so it should be fine, because I 
don't think qemu is supposed to work with any other compiler anyway...

Max
Gerd Hoffmann May 26, 2015, 2:12 p.m. UTC | #2
On Di, 2015-05-26 at 16:06 +0200, Max Reitz wrote:
> On 26.05.2015 14:56, Gerd Hoffmann wrote:
> > On Di, 2015-05-26 at 08:35 +0200, Gerd Hoffmann wrote:
> >>    Hi,
> >>
> >>> only). That, or pass -Wno-deprecated-declarations for compiling
> >>> ui/gtk.c, but that seems very ugly to me.
> >> We can also try some #pragma warn dance, to limit the
> >> -Wno-deprecated-declarations to a small code block.
> >>
> >> We have something simliar already for a bug in the gtk2 headers.
> > i.e. like this:
> 
> I don't like it very much, but you're the maintainer, so if you deem it 
> acceptable, I won't object. :-)

It's not pretty indeed.

But turning off deprecated declarations for the whole file (which would
be a much less ugly one-liner in the Makefile) isn't a good solution
either because gtk actually deprecates things now and then and I'd like
us notice.

If someone has better ideas I'm all ears.

cheers,
  Gerd
diff mbox

Patch

From 21b26f0f0bc57c209381fd13c7ca01ea97354dfc Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 26 May 2015 11:52:08 +0200
Subject: [PATCH] gtk: silence gtk_widget_set_double_buffered warning

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 0b87aa6..126326a 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1739,7 +1739,20 @@  static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
 
 #if defined(CONFIG_OPENGL)
     if (display_opengl) {
+        /*
+         * gtk_widget_set_double_buffered() was deprecated in 3.14.
+         * It is required for opengl rendering on X11 though.  A
+         * proper replacement (native opengl support) is only
+         * available in 3.16+.  Silence the warning if possible.
+         */
+#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
         gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE);
+#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
+#pragma GCC diagnostic pop
+#endif
         vc->gfx.dcl.ops = &dcl_egl_ops;
     } else
 #endif
-- 
1.8.3.1