[gtk+] Explicitly declare internal reserved bits in GdkModifierType
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Explicitly declare internal reserved bits in GdkModifierType
- Date: Mon, 16 May 2011 16:40:32 +0000 (UTC)
commit 7bc2f539d06db170f54d089302952ce8046acdea
Author: Colin Walters <walters verbum org>
Date: Tue Nov 16 10:58:58 2010 -0500
Explicitly declare internal reserved bits in GdkModifierType
XKB and GDK both add "internal" bits to GdkModifierType. In C,
this typically doesn't cause problems as bitfields are just integers,
and there's no validation. However for bindings, it's normal to
convert enumerations to "native" enumeration types, which don't
support unknown bits. See bug 597292.
https://bugzilla.gnome.org/show_bug.cgi?id=634994
gdk/gdktypes.h | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index c3ab38f..87ac3b2 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -172,6 +172,7 @@ typedef enum
* @GDK_BUTTON3_MASK: the third mouse button.
* @GDK_BUTTON4_MASK: the fourth mouse button.
* @GDK_BUTTON5_MASK: the fifth mouse button.
+ * @GDK_MODIFIER_RESERVED_13_MASK: A reserved bit flag; do not use in your own code
* @GDK_SUPER_MASK: the Super modifier. Since 2.10
* @GDK_HYPER_MASK: the Hyper modifier. Since 2.10
* @GDK_META_MASK: the Meta modifier. Since 2.10
@@ -188,6 +189,11 @@ typedef enum
* Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
* to Mod2 - Mod5, and indicates this by setting %GDK_SUPER_MASK,
* %GDK_HYPER_MASK or %GDK_META_MASK in the state field of key events.
+ *
+ * Note that GDK may add internal values to events which include
+ * reserved values such as %GDK_MODIFIER_RESERVED_13_MASK. Your code
+ * should preserve and ignore them. You can use %GDK_MODIFIER_MASK to
+ * remove all reserved values.
*/
typedef enum
{
@@ -205,6 +211,20 @@ typedef enum
GDK_BUTTON4_MASK = 1 << 11,
GDK_BUTTON5_MASK = 1 << 12,
+ GDK_MODIFIER_RESERVED_13_MASK = 1 << 13,
+ GDK_MODIFIER_RESERVED_14_MASK = 1 << 14,
+ GDK_MODIFIER_RESERVED_15_MASK = 1 << 15,
+ GDK_MODIFIER_RESERVED_16_MASK = 1 << 16,
+ GDK_MODIFIER_RESERVED_17_MASK = 1 << 17,
+ GDK_MODIFIER_RESERVED_18_MASK = 1 << 18,
+ GDK_MODIFIER_RESERVED_19_MASK = 1 << 19,
+ GDK_MODIFIER_RESERVED_20_MASK = 1 << 20,
+ GDK_MODIFIER_RESERVED_21_MASK = 1 << 21,
+ GDK_MODIFIER_RESERVED_22_MASK = 1 << 22,
+ GDK_MODIFIER_RESERVED_23_MASK = 1 << 23,
+ GDK_MODIFIER_RESERVED_24_MASK = 1 << 24,
+ GDK_MODIFIER_RESERVED_25_MASK = 1 << 25,
+
/* The next few modifiers are used by XKB, so we skip to the end.
* Bits 15 - 25 are currently unused. Bit 29 is used internally.
*/
@@ -213,8 +233,12 @@ typedef enum
GDK_HYPER_MASK = 1 << 27,
GDK_META_MASK = 1 << 28,
+ GDK_MODIFIER_RESERVED_29_MASK = 1 << 29,
+
GDK_RELEASE_MASK = 1 << 30,
+ /* Combination of GDK_SHIFT_MASK..GDK_BUTTON5_MASK + GDK_SUPER_MASK
+ + GDK_HYPER_MASK + GDK_META_MASK + GDK_RELEASE_MASK */
GDK_MODIFIER_MASK = 0x5c001fff
} GdkModifierType;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]