diff mbox

[1/2] ui/gtk: Support versions of gtk+-2.0 before 2.90.7

Message ID 1361559400-21808-1-git-send-email-sw@weilnetz.de
State Superseded
Headers show

Commit Message

Stefan Weil Feb. 22, 2013, 6:56 p.m. UTC
This is needed for current Debian stable (Squeeze).

Extract from NEWS in gtk+-2.0:

  Overview of Changes from GTK+ 2.90.6 to 2.90.7
  ==============================================

  * All GDK keysym names have been changed from GDK_keysym to GDK_KEY_keysym;
    the previous names are still available in gdkkeysyms-compat.h.

For versions before 2.90.7, the new names are now mapped to the old ones.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 ui/gtk.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Anthony Liguori Feb. 22, 2013, 7:28 p.m. UTC | #1
Stefan Weil <sw@weilnetz.de> writes:

> This is needed for current Debian stable (Squeeze).
>
> Extract from NEWS in gtk+-2.0:
>
>   Overview of Changes from GTK+ 2.90.6 to 2.90.7
>   ==============================================
>
>   * All GDK keysym names have been changed from GDK_keysym to GDK_KEY_keysym;
>     the previous names are still available in gdkkeysyms-compat.h.
>
> For versions before 2.90.7, the new names are now mapped to the old ones.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  ui/gtk.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index f82ced0..10bac94 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -64,6 +64,17 @@
>  
>  #define MAX_VCS 10
>  
> +#if !GTK_CHECK_VERSION(2, 90, 7)

I'm not sure what you're doing, but you're using GTK-3, not GTK-2.

GDK_f is the GTK-3 name.  It's always been GDK_KEY_f in GTK-2.  Much
like QEMU, 2.90 means 3.0-rc0 for GTK.

Regards,

Anthony Liguori

> +#define GDK_KEY_f GDK_f
> +#define GDK_KEY_g GDK_g
> +#define GDK_KEY_0 GDK_0
> +#define GDK_KEY_1 GDK_1
> +#define GDK_KEY_2 GDK_2
> +#define GDK_KEY_equal GDK_equal
> +#define GDK_KEY_minus GDK_minus
> +#define GDK_KEY_plus GDK_plus
> +#endif
> +
>  typedef struct VirtualConsole
>  {
>      GtkWidget *menu_item;
> -- 
> 1.7.10.4
Stefan Weil Feb. 22, 2013, 7:40 p.m. UTC | #2
Am 22.02.2013 20:28, schrieb Anthony Liguori:
> Stefan Weil <sw@weilnetz.de> writes:
>
>> This is needed for current Debian stable (Squeeze).
>>
>> Extract from NEWS in gtk+-2.0:
>>
>>   Overview of Changes from GTK+ 2.90.6 to 2.90.7
>>   ==============================================
>>
>>   * All GDK keysym names have been changed from GDK_keysym to GDK_KEY_keysym;
>>     the previous names are still available in gdkkeysyms-compat.h.
>>
>> For versions before 2.90.7, the new names are now mapped to the old ones.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>  ui/gtk.c |   11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/ui/gtk.c b/ui/gtk.c
>> index f82ced0..10bac94 100644
>> --- a/ui/gtk.c
>> +++ b/ui/gtk.c
>> @@ -64,6 +64,17 @@
>>  
>>  #define MAX_VCS 10
>>  
>> +#if !GTK_CHECK_VERSION(2, 90, 7)
> I'm not sure what you're doing, but you're using GTK-3, not GTK-2.
>
> GDK_f is the GTK-3 name.  It's always been GDK_KEY_f in GTK-2.  Much
> like QEMU, 2.90 means 3.0-rc0 for GTK.
>
> Regards,
>
> Anthony Liguori


Please see http://git.gnome.org/browse/gtk+/tree/NEWS
(look for |GDK_KEY_keysym).

This and the VTE patch which you have already reviewed
are necessary for Debian stable, so I'd appreciate if
both patches could be applied soon.

Thanks,

Stefan Weil

|
Anthony Liguori Feb. 22, 2013, 8 p.m. UTC | #3
Stefan Weil <sw@weilnetz.de> writes:

> This is needed for current Debian stable (Squeeze).
>
> Extract from NEWS in gtk+-2.0:
>
>   Overview of Changes from GTK+ 2.90.6 to 2.90.7
>   ==============================================
>
>   * All GDK keysym names have been changed from GDK_keysym to GDK_KEY_keysym;
>     the previous names are still available in gdkkeysyms-compat.h.

Looks like this happened in 2.22 as best as I can tell.

What I would suggest doing is:

#ifndef GDK_KEY_f
#define GDK_KEY_f GDK_f
#define GDK_KEY_g GDK_g
...
#endif

Regards,

Anthony Liguori

>
> For versions before 2.90.7, the new names are now mapped to the old ones.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  ui/gtk.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index f82ced0..10bac94 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -64,6 +64,17 @@
>  
>  #define MAX_VCS 10
>  
> +#if !GTK_CHECK_VERSION(2, 90, 7)
> +#define GDK_KEY_f GDK_f
> +#define GDK_KEY_g GDK_g
> +#define GDK_KEY_0 GDK_0
> +#define GDK_KEY_1 GDK_1
> +#define GDK_KEY_2 GDK_2
> +#define GDK_KEY_equal GDK_equal
> +#define GDK_KEY_minus GDK_minus
> +#define GDK_KEY_plus GDK_plus
> +#endif
> +
>  typedef struct VirtualConsole
>  {
>      GtkWidget *menu_item;
> -- 
> 1.7.10.4
Stefan Weil Feb. 22, 2013, 8:14 p.m. UTC | #4
Am 22.02.2013 21:00, schrieb Anthony Liguori:
> Stefan Weil <sw@weilnetz.de> writes:
>
>> This is needed for current Debian stable (Squeeze).
>>
>> Extract from NEWS in gtk+-2.0:
>>
>>   Overview of Changes from GTK+ 2.90.6 to 2.90.7
>>   ==============================================
>>
>>   * All GDK keysym names have been changed from GDK_keysym to GDK_KEY_keysym;
>>     the previous names are still available in gdkkeysyms-compat.h.
> Looks like this happened in 2.22 as best as I can tell.
>
> What I would suggest doing is:
>
> #ifndef GDK_KEY_f
> #define GDK_KEY_f GDK_f
> #define GDK_KEY_g GDK_g
> ...
> #endif
>
> Regards,
>
> Anthony Liguori

That would work, too.

Nevertheless the current patch is also fine, because it
matches the information in GTK's NEWS files:the change
was from GTK+ 2.90.6 to 2.90.7.

This was the GTK+ commit:

commit 913cdf3be750a1e74c09b20edf55a57f9a919fcc
Author: Colin Walters <walters@verbum.org>
Date:   Wed Sep 8 13:35:51 2010 -0400

    GDK: Prefix key names with KEY_
   
    The keysyms create a lot of potential namespace conflicts for
    C, and are especially problematic for introspection, where we take
    constants into the namespace, so GDK_Display conflicts with GdkDisplay.
   
    For C application compatiblity, add gdkkeysyms-compat.h which uses
    the old names.
   
    Just one user in GTK+ continues to use gdkkeysyms-compat.h, which is
    the gtkimcontextsimple.c, since porting that requires porting more
    custom Perl code.

Regards,
Stefan Weil
diff mbox

Patch

diff --git a/ui/gtk.c b/ui/gtk.c
index f82ced0..10bac94 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -64,6 +64,17 @@ 
 
 #define MAX_VCS 10
 
+#if !GTK_CHECK_VERSION(2, 90, 7)
+#define GDK_KEY_f GDK_f
+#define GDK_KEY_g GDK_g
+#define GDK_KEY_0 GDK_0
+#define GDK_KEY_1 GDK_1
+#define GDK_KEY_2 GDK_2
+#define GDK_KEY_equal GDK_equal
+#define GDK_KEY_minus GDK_minus
+#define GDK_KEY_plus GDK_plus
+#endif
+
 typedef struct VirtualConsole
 {
     GtkWidget *menu_item;