summaryrefslogtreecommitdiff
path: root/gtk/gtkaccelgroup.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-06-30 08:20:45 +0000
committerTim Janik <timj@src.gnome.org>1998-06-30 08:20:45 +0000
commit80b0b3ea05c4575911f37fa5ad66d7deeaef0ad6 (patch)
treeb6fb0172e827a66a8b202ccbfc39ceb1c1615dd2 /gtk/gtkaccelgroup.c
parentbf44f089cd6e9a613dd5b6a08fee66e14df347e1 (diff)
downloadgdk-pixbuf-80b0b3ea05c4575911f37fa5ad66d7deeaef0ad6.tar.gz
ok, this enables the possibility for key-release bindings.
but nearly no widget really cares to set GDK_KEY_RELEASE_MASK, which needs to be enabled in order for release bindings to work. Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org> * gtk/gtkaccelgroup.c (gtk_accelerator_parse): parse "<Release>" modifier as well. (gtk_accelerator_name): add "<Release>" to the accelerator name if neccessary. * gtk/gtkbindings.c (BINDING_MOD_MASK): take BINDING_MOD_MASK into account. * gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented default handler for key-release events, which checks for activation of GDK_RELEASE_MASK key bindings. * gdk/gdktypes.h (enum): added GDK_RELEASE_MASK to GdkModifierType.
Diffstat (limited to 'gtk/gtkaccelgroup.c')
-rw-r--r--gtk/gtkaccelgroup.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 0824e2a2a..c8c3e908f 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -844,6 +844,20 @@ is_control (const gchar *string)
(string[8] == '>'));
}
+static inline gboolean
+is_release (const gchar *string)
+{
+ return ((string[0] == '<') &&
+ (string[1] == 'r' || string[1] == 'R') &&
+ (string[2] == 'e' || string[2] == 'E') &&
+ (string[3] == 'l' || string[3] == 'L') &&
+ (string[4] == 'e' || string[4] == 'E') &&
+ (string[5] == 'a' || string[5] == 'A') &&
+ (string[6] == 's' || string[6] == 'S') &&
+ (string[7] == 'e' || string[7] == 'E') &&
+ (string[8] == '>'));
+}
+
void
gtk_accelerator_parse (const gchar *accelerator,
guint *accelerator_key,
@@ -866,7 +880,13 @@ gtk_accelerator_parse (const gchar *accelerator,
{
if (*accelerator == '<')
{
- if (len >= 9 && is_control (accelerator))
+ if (len >= 9 && is_release (accelerator))
+ {
+ accelerator += 9;
+ len -= 9;
+ mods |= GDK_RELEASE_MASK;
+ }
+ else if (len >= 9 && is_control (accelerator))
{
accelerator += 9;
len -= 9;
@@ -947,6 +967,7 @@ gtk_accelerator_name (guint accelerator_key,
{
static const gchar text_shift[] = "<Shift>";
static const gchar text_control[] = "<Control>";
+ static const gchar text_release[] = "<Release>";
static const gchar text_mod1[] = "<Alt>";
static const gchar text_mod2[] = "<Mod2>";
static const gchar text_mod3[] = "<Mod3>";
@@ -967,6 +988,8 @@ gtk_accelerator_name (guint accelerator_key,
l += sizeof (text_shift) - 1;
if (accelerator_mods & GDK_CONTROL_MASK)
l += sizeof (text_control) - 1;
+ if (accelerator_mods & GDK_RELEASE_MASK)
+ l += sizeof (text_release) - 1;
if (accelerator_mods & GDK_MOD1_MASK)
l += sizeof (text_mod1) - 1;
if (accelerator_mods & GDK_MOD2_MASK)
@@ -993,6 +1016,11 @@ gtk_accelerator_name (guint accelerator_key,
strcpy (accelerator + l, text_control);
l += sizeof (text_control) - 1;
}
+ if (accelerator_mods & GDK_RELEASE_MASK)
+ {
+ strcpy (accelerator + l, text_release);
+ l += sizeof (text_release) - 1;
+ }
if (accelerator_mods & GDK_MOD1_MASK)
{
strcpy (accelerator + l, text_mod1);