Re: Why keysym constants in gdk/gdkkeysyms.h are defined as macros, not as an enum?



On Tue, 2012-06-26 at 16:02 +0300, Mark Vender wrote:
> Hello,
> 
> Is there any reason why preprocessor macros are used to define the GDK 
> keysym constants in gdk/gdkkeysyms.h instead of an enum? For what it's 
> worth, there's no advantage in using macros. They are inconsistent with 
> other enumerations within GTK+ library, which universally use enums. An 
> enum offers better scoping and would be easier to wrap on the C++ side.
> 
> If there's support, I could prepare a patch that converts the keysym 
> macros to an enum. From the user's point of view enum and macro 
> constants are equivalent, so there's no need to wait for an API/ABI break.

If we used enums, we would restrict the keysyms to the declared values.
It's possible for keysyms not to have a constant declared in GDK, for
example when a new keysym has been added to X.org but GDK hasn't been
updated yet. So using enums instead of constants is detrimental to
applications and GTK+ not breaking when keysyms get added.

Cheers



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