Constants names change in Gdk::KeyVal

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.

On Fri, Oct 8, 2010 at 4:49 PM, Vincent C. [email protected]
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. - http://zarb.org/~gc/

2010/10/8 Guillaume C. [email protected]:

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.

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

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

Vincent C.

2010/10/9 Vincent C. [email protected]:

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

[1]
http://git.gnome.org/browse/gtk+/commit/?h=gtk-2-22&id=750c81f43dda6c783372b983e630ecd30b776d7e
[2]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.

On Sat, Oct 9, 2010 at 2:26 AM, Vincent C. [email protected]
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. - http://zarb.org/~gc/

2010/10/9 Guillaume C. [email protected]:

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.

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 ?

2010/10/10 Guillaume C. [email protected]:

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.

I will reupload a patch.
Done.

Can you test it ?

On Sat, Oct 9, 2010 at 5:52 PM, Vincent C. [email protected]
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. - http://zarb.org/~gc/

2010/10/11 Guillaume C. removed_e[email protected]:

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

doh, what’s that on line 16!?

On Mon, Oct 11, 2010 at 12:22 AM, Vincent C. [email protected]
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


ruby-gnome2-devel-en mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en


Guillaume C. - http://zarb.org/~gc/

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] Constants names change in Gdk::KeyVal” on
Mon, 11 Oct 2010 22:31:15 +0200,
Vincent C. [email protected] wrote:

2010/10/11 Guillaume C. [email protected]:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs