[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: Inlining Gtk2::Gdk::Keysyms ?



From: gtk-perl-list-bounces gnome org on behalf of muppet
...8<...
> The code in Keysyms.pm is generated at build time from gdkkeysyms.h.  Since
> gtk+ is API-stable, i would have to imagine that the values of the keycodes
> cannot change.  I don't know if that extends to using the exact same keycodes
> for X and Win32, but if you only need a few keycodes, you ought to be safe
> creating your own mapping for just those.

I noticed some changes in the keycode that cetain key combos emit after a recent update, for example shift+Tab became ISO_Left_Tab. But I needed to patch this anyway, the values in the hash do not change, the values in the events change.

> Officially:  I do not endorse this duplication, as it is duplication and i'm
> not convinced you'll actually save much memory.


Already I'm assingning the keys that I need to local variables because I need them often in switch statements and calling the hash every time makes the code harder to read. I figure that since I only need 5 codes out of approx 1400 it is worth inlining them as constants which will be optimized by the compiler. Maybe it will not save much memory, but it might make the code a bit more readable as well.


Thanks for your comment,

Regards,

-- jaap <pardsu cpan org>

 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]