diff mbox

ui/gtk: fix build on GTK 2.18 and older

Message ID 1361541090-6168-1-git-send-email-aliguori@us.ibm.com
State New
Headers show

Commit Message

Anthony Liguori Feb. 22, 2013, 1:51 p.m. UTC
Reported-by: Gerd Hoffman <kraxel@redhat.com>
Suggested-by: Daniel Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 ui/gtk.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Gerd Hoffmann Feb. 22, 2013, 2:11 p.m. UTC | #1
Hi,

> +#if !GTK_CHECK_VERSION(2, 18, 0)
> +#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
> +#endif

Not working:

  CC    ui/gtk.o
cc1: warnings being treated as errors
/home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_draw_event’:
/home/kraxel/projects/qemu/ui/gtk.c:355: error: implicit declaration of
function ‘gtk_widget_get_realized’
/home/kraxel/projects/qemu/ui/gtk.c:355: error: nested extern
declaration of ‘gtk_widget_get_realized’

Oh, and I just saw there is more, GDK_KEY_* seems to be new too:

/home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_vc_init’:
/home/kraxel/projects/qemu/ui/gtk.c:885: error: ‘GDK_KEY_2’ undeclared
(first use in this function)
/home/kraxel/projects/qemu/ui/gtk.c:885: error: (Each undeclared
identifier is reported only once
/home/kraxel/projects/qemu/ui/gtk.c:885: error: for each function it
appears in.)
/home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_create_menus’:
/home/kraxel/projects/qemu/ui/gtk.c:1009: error: ‘GDK_KEY_f’ undeclared
(first use in this function)
/home/kraxel/projects/qemu/ui/gtk.c:1018: error: ‘GDK_KEY_plus’
undeclared (first use in this function)
/home/kraxel/projects/qemu/ui/gtk.c:1024: error: ‘GDK_KEY_minus’
undeclared (first use in this function)
/home/kraxel/projects/qemu/ui/gtk.c:1030: error: ‘GDK_KEY_0’ undeclared
(first use in this function)
/home/kraxel/projects/qemu/ui/gtk.c:1045: error: ‘GDK_KEY_g’ undeclared
(first use in this function)
/home/kraxel/projects/qemu/ui/gtk.c:1055: error: ‘GDK_KEY_1’ undeclared
(first use in this function)
gmake: *** [ui/gtk.o] Error 1

cheers,
  Gerd
Anthony Liguori Feb. 22, 2013, 2:53 p.m. UTC | #2
Gerd Hoffmann <kraxel@redhat.com> writes:

>   Hi,
>
>> +#if !GTK_CHECK_VERSION(2, 18, 0)
>> +#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
>> +#endif
>
> Not working:
>
>   CC    ui/gtk.o
> cc1: warnings being treated as errors
> /home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_draw_event’:
> /home/kraxel/projects/qemu/ui/gtk.c:355: error: implicit declaration of
> function ‘gtk_widget_get_realized’
> /home/kraxel/projects/qemu/ui/gtk.c:355: error: nested extern
> declaration of ‘gtk_widget_get_realized’
>
> Oh, and I just saw there is more, GDK_KEY_* seems to be new too:

GDK_KEY_ is most definitely not new.  Is this RHEL5?

Regards,

Anthony Liguori

>
> /home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_vc_init’:
> /home/kraxel/projects/qemu/ui/gtk.c:885: error: ‘GDK_KEY_2’ undeclared
> (first use in this function)
> /home/kraxel/projects/qemu/ui/gtk.c:885: error: (Each undeclared
> identifier is reported only once
> /home/kraxel/projects/qemu/ui/gtk.c:885: error: for each function it
> appears in.)
> /home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_create_menus’:
> /home/kraxel/projects/qemu/ui/gtk.c:1009: error: ‘GDK_KEY_f’ undeclared
> (first use in this function)
> /home/kraxel/projects/qemu/ui/gtk.c:1018: error: ‘GDK_KEY_plus’
> undeclared (first use in this function)
> /home/kraxel/projects/qemu/ui/gtk.c:1024: error: ‘GDK_KEY_minus’
> undeclared (first use in this function)
> /home/kraxel/projects/qemu/ui/gtk.c:1030: error: ‘GDK_KEY_0’ undeclared
> (first use in this function)
> /home/kraxel/projects/qemu/ui/gtk.c:1045: error: ‘GDK_KEY_g’ undeclared
> (first use in this function)
> /home/kraxel/projects/qemu/ui/gtk.c:1055: error: ‘GDK_KEY_1’ undeclared
> (first use in this function)
> gmake: *** [ui/gtk.o] Error 1
>
> cheers,
>   Gerd
Gerd Hoffmann Feb. 22, 2013, 4:18 p.m. UTC | #3
On 02/22/13 15:53, Anthony Liguori wrote:
> Gerd Hoffmann <kraxel@redhat.com> writes:
> 
>>   Hi,
>>
>>> +#if !GTK_CHECK_VERSION(2, 18, 0)
>>> +#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
>>> +#endif
>>
>> Not working:
>>
>>   CC    ui/gtk.o
>> cc1: warnings being treated as errors
>> /home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_draw_event’:
>> /home/kraxel/projects/qemu/ui/gtk.c:355: error: implicit declaration of
>> function ‘gtk_widget_get_realized’
>> /home/kraxel/projects/qemu/ui/gtk.c:355: error: nested extern
>> declaration of ‘gtk_widget_get_realized’
>>
>> Oh, and I just saw there is more, GDK_KEY_* seems to be new too:
> 
> GDK_KEY_ is most definitely not new.  Is this RHEL5?

No, RHEL-6.

cheers,
  Gerd
Daniel P. Berrangé Feb. 25, 2013, 3:23 p.m. UTC | #4
On Fri, Feb 22, 2013 at 07:51:30AM -0600, Anthony Liguori wrote:
> Reported-by: Gerd Hoffman <kraxel@redhat.com>
> Suggested-by: Daniel Berrange <berrange@redhat.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  ui/gtk.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 5f91de4..46e30b9 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -122,6 +122,10 @@ typedef struct GtkDisplayState
>  
>  static GtkDisplayState *global_state;
>  
> +#if !GTK_CHECK_VERSION(2, 18, 0)

This version check is wrong - it needs to be "2, 20, 0", so that
any <= 2.18.x gets the compat wrapper.

> +#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
> +#endif
> +

I've sent a patch to fix this & the other problems in 2.18

Daniel
Daniel P. Berrangé Feb. 25, 2013, 3:26 p.m. UTC | #5
On Fri, Feb 22, 2013 at 08:53:13AM -0600, Anthony Liguori wrote:
> Gerd Hoffmann <kraxel@redhat.com> writes:
> 
> >   Hi,
> >
> >> +#if !GTK_CHECK_VERSION(2, 18, 0)
> >> +#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
> >> +#endif
> >
> > Not working:
> >
> >   CC    ui/gtk.o
> > cc1: warnings being treated as errors
> > /home/kraxel/projects/qemu/ui/gtk.c: In function ‘gd_draw_event’:
> > /home/kraxel/projects/qemu/ui/gtk.c:355: error: implicit declaration of
> > function ‘gtk_widget_get_realized’
> > /home/kraxel/projects/qemu/ui/gtk.c:355: error: nested extern
> > declaration of ‘gtk_widget_get_realized’
> >
> > Oh, and I just saw there is more, GDK_KEY_* seems to be new too:
> 
> GDK_KEY_ is most definitely not new.  Is this RHEL5?

Actually it is new.  GTK3 introduced GDK_KEY_xxx symbols. Originally
GTK2 was using just GTK_xxx. The most recent versions of GTK2 have
now also introduced GTK_KEY_xxx, but kept GTK_xxx for compat. Hence
why we see the failures on 2.18 GTK which only supports GTK_xxx
symbols. I've sent a patch to fix this.

Regards,
Daniel
diff mbox

Patch

diff --git a/ui/gtk.c b/ui/gtk.c
index 5f91de4..46e30b9 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -122,6 +122,10 @@  typedef struct GtkDisplayState
 
 static GtkDisplayState *global_state;
 
+#if !GTK_CHECK_VERSION(2, 18, 0)
+#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
+#endif
+
 /** Utility Functions **/
 
 static bool gd_is_grab_active(GtkDisplayState *s)