# Constants names change in Gdk::KeyVal

**URL:** <https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214>\
**Category:** Ruby-Gnome 2\
**Created:** [October 8, 2010, 4:50pm UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214 "2010-10-08T16:50:48Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 8, 2010, 4:50pm UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/1 "2010-10-08T16:50:48Z")

</div>

Hi.

Gdk::KeyVal constants used to be named GDK\_value. Now they are named  
GDK\_KEY\_value.  
It breaks my applications. Is it a willingly change or a bug ?

I have update my git repository from the online svn one.

–  
Vincent C.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 8, 2010, 11:20pm UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/2 "2010-10-08T23:20:05Z")

</div>

On Fri, Oct 8, 2010 at 4:49 PM, Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi.
> 
> Gdk::KeyVal constants used to be named GDK\_value. Now they are named  
> GDK\_KEY\_value.  
> It breaks my applications. Is it a willingly change or a bug ?
> 
> I have update my git repository from the online svn one.

I have no problem in that field, using svn head (with ruby 1.9.1p378).  
Do you have a small test case?

```
if event.state & Gdk::Window::MOD1_MASK != 0
    #- ALT pressed: Alt-Left and Alft-Right rotate
    if event.keyval == Gdk::Keyval::GDK_Left || event.keyval ==

```

Gdk::Keyval::GDK\_Right  
if event.keyval == Gdk::Keyval::GDK\_Left  
entry.angle = (entry.angle - 90) % 360

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 8, 2010, 11:56pm UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/3 "2010-10-08T23:56:57Z")

</div>

2010/10/8 Guillaume C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have no problem in that field, using svn head (with ruby 1.9.1p378).  
> Do you have a small test case?

require ‘gtk2’  
p Gtk::VERSION  
p Gdk::Keyval::GDK\_KEY\_p  
p Gdk::Keyval::GDK\_p

ruby es.rb  
[2, 22, 0]  
112  
./es.rb:6: uninitialized constant Gdk::Keyval::GDK\_p (NameError)

Maybe it depends on gdk version. What is your value of Gtk::VERSION ?

–  
Vincent C.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 9, 2010, 12:31am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/4 "2010-10-09T00:31:29Z")

</div>

I take a look at gdk/gdkkeysyms-compat.h and at gdk/gdkkeysyms.h .

gdk/gdkkeysyms-compat.h  
#define GDK\_p 0x070

gdk/gdkkeysyms.h  
#define GDK\_KEY\_p 0x070

According to git repo [1] the 2.20 version use the GDK\_value style :  
gdk/gdkkeysyms.h  
#define GDK\_p 0x070

[1] [http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms.h?h=gtk-2-20](http://git.gnome.org/browse/gtk+/tree/gdk/gdkkeysyms.h?h=gtk-2-20)

## I do not see a bug report on gtk+. Someone does ?

Vincent C.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 9, 2010, 1:15am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/5 "2010-10-09T01:15:24Z")

</div>

2010/10/9 Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

I have found the commit [1] that introduce the change and also the bug  
report [2].

[1]

> **[Sign in · GitLab](https://gitlab.gnome.org/users/sign_in)**
>
> Welcome to GNOME GitLab

[2][Bug 629093 – [patch] prefix GDK key names](https://bugzilla.gnome.org/show_bug.cgi?id=629093)

GDK\_KEY\_name is now used instead of GDK\_name in gdk/gdkkeysyms.h.  
gdk/gdkkeysyms-compat.h defines the old constants (GDK\_name).

Can ruby-gnome2 uses the 2 styles until gtk3 ?

–  
Vincent C.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 10, 2010, 4:09am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/6 "2010-10-10T04:09:33Z")

</div>

On Sat, Oct 9, 2010 at 2:26 AM, Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Gtk support both naming conventions until the 3.0 version.  
> For version 3, gdk/gdkkeysyms-compat.h may still be present but will  
> not be inclued by default. (See gdk/gdkkeysyms.h.)
> 
> I join a patch to support both conventions.  
> If ruby-gnome2 decide to support both conventions can you review the patch ?  
> Should I check gtk version ? How ?

I think it’s better to test for feature availability than gtk version,  
because we don’t know for sure what features may be added/removed in  
versions. So for me your patch looks fine! (have you tested it?)

PS: I was using gtk 2.20

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 10, 2010, 4:56am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/7 "2010-10-10T04:56:58Z")

</div>

2010/10/9 Guillaume C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> because we don’t know for sure what features may be added/removed in  
> versions. So for me your patch looks fine! (have you tested it?)
> 
> PS: I was using gtk 2.20

I have tested it. It works fine with gtk 2.22. Can you test it with 2.20  
?

I was willingly to test for gtk 3 version in order to drop the old  
naming convention in time.

–  
Vincent C.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 10, 2010, 4:00am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/8 "2010-10-10T04:00:46Z")

</div>

Gtk support both naming conventions until the 3.0 version.  
For version 3, gdk/gdkkeysyms-compat.h may still be present but will  
not be inclued by default. (See gdk/gdkkeysyms.h.)

I join a patch to support both conventions.  
If ruby-gnome2 decide to support both conventions can you review the  
patch ?  
Should I check gtk version ? How ?

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 10, 2010, 11:41pm UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/9 "2010-10-10T23:41:22Z")

</div>

2010/10/10 Guillaume C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> renamed gtk2 some time ago.

I forgot to rebase my local git repo :-(. I was working on an old  
branch!  
Sorry about that.  
I will reupload a patch.

–  
Vincent C.

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 11, 2010, 12:22am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/10 "2010-10-11T00:22:56Z")

</div>

> I will reupload a patch.  
> Done.

Can you test it ?

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 10, 2010, 10:49pm UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/11 "2010-10-10T22:49:17Z")

</div>

On Sat, Oct 9, 2010 at 5:52 PM, Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > I think it’s better to test for feature availability than gtk version,  
> > because we don’t know for sure what features may be added/removed in  
> > versions. So for me your patch looks fine! (have you tested it?)
> > 
> > PS: I was using gtk 2.20
> 
> I have tested it. It works fine with gtk 2.22. Can you test it with 2.20 ?

i don’t have gtk/extconf.rb but gtk2/extconf.rb, and it looks so  
different that the two hunks of the patch fail.

this is a recent “clean” checkout. i noticed that gtk submodule was  
renamed gtk2 some time ago.

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 12, 2010, 2:47am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/12 "2010-10-12T02:47:41Z")

</div>

2010/10/11 Guillaume C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> doh, what’s that on line 16!?  
> line 16 should be:  
> gdkkeysyms\_compat = true if FileTest.exist?(i +  
> “/gdk/gdkkeysyms-compat.h”)

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 12, 2010, 1:42am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/13 "2010-10-12T01:42:01Z")

</div>

doh, what’s that on line 16!?

On Mon, Oct 11, 2010 at 12:22 AM, Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.  
> Spend less time writing and rewriting code and more time creating great  
> experiences on the web. Be a part of the beta today.  
> [http://p.sf.net/sfu/beautyoftheweb](http://p.sf.net/sfu/beautyoftheweb)
> 
> * * *
> 
> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

–  
Guillaume C. - [NVC Communication Obstacles Game](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![coubi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c68b51/32.png) [@coubi](https://www.ruby-forum.com/u/coubi)\
**Post date:** [October 12, 2010, 2:55am UTC](https://www.ruby-forum.com/t/constants-names-change-in-gdk-keyval/196214/14 "2010-10-12T02:55:47Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“Re: [ruby-gnome2-devel-en] Constants names change in Gdk::KeyVal” on  
Mon, 11 Oct 2010 22:31:15 +0200,  
Vincent C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 2010/10/11 Guillaume C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > doh, what’s that on line 16!?  
> > line 16 should be:  
> > gdkkeysyms\_compat = true if FileTest.exist?(i + “/gdk/gdkkeysyms-compat.h”)

Thanks for your patch!  
I’ve committed it in trunk.

## Thanks,

kou
