mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 21:40:19 +00:00
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.
This commit is contained in:
parent
bf44f089cd
commit
80b0b3ea05
@ -1,5 +1,13 @@
|
|||||||
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
|
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
|
* gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented
|
||||||
default handler for key-release events, which checks for activation
|
default handler for key-release events, which checks for activation
|
||||||
of GDK_RELEASE_MASK key bindings.
|
of GDK_RELEASE_MASK key bindings.
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
|
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
|
* gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented
|
||||||
default handler for key-release events, which checks for activation
|
default handler for key-release events, which checks for activation
|
||||||
of GDK_RELEASE_MASK key bindings.
|
of GDK_RELEASE_MASK key bindings.
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
|
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
|
* gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented
|
||||||
default handler for key-release events, which checks for activation
|
default handler for key-release events, which checks for activation
|
||||||
of GDK_RELEASE_MASK key bindings.
|
of GDK_RELEASE_MASK key bindings.
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
|
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
|
* gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented
|
||||||
default handler for key-release events, which checks for activation
|
default handler for key-release events, which checks for activation
|
||||||
of GDK_RELEASE_MASK key bindings.
|
of GDK_RELEASE_MASK key bindings.
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
|
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
|
* gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented
|
||||||
default handler for key-release events, which checks for activation
|
default handler for key-release events, which checks for activation
|
||||||
of GDK_RELEASE_MASK key bindings.
|
of GDK_RELEASE_MASK key bindings.
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
|
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
|
* gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented
|
||||||
default handler for key-release events, which checks for activation
|
default handler for key-release events, which checks for activation
|
||||||
of GDK_RELEASE_MASK key bindings.
|
of GDK_RELEASE_MASK key bindings.
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
|
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
|
* gtk/gtkwidget.c (gtk_widget_real_key_release_event): implemented
|
||||||
default handler for key-release events, which checks for activation
|
default handler for key-release events, which checks for activation
|
||||||
of GDK_RELEASE_MASK key bindings.
|
of GDK_RELEASE_MASK key bindings.
|
||||||
|
@ -844,6 +844,20 @@ is_control (const gchar *string)
|
|||||||
(string[8] == '>'));
|
(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
|
void
|
||||||
gtk_accelerator_parse (const gchar *accelerator,
|
gtk_accelerator_parse (const gchar *accelerator,
|
||||||
guint *accelerator_key,
|
guint *accelerator_key,
|
||||||
@ -866,7 +880,13 @@ gtk_accelerator_parse (const gchar *accelerator,
|
|||||||
{
|
{
|
||||||
if (*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;
|
accelerator += 9;
|
||||||
len -= 9;
|
len -= 9;
|
||||||
@ -947,6 +967,7 @@ gtk_accelerator_name (guint accelerator_key,
|
|||||||
{
|
{
|
||||||
static const gchar text_shift[] = "<Shift>";
|
static const gchar text_shift[] = "<Shift>";
|
||||||
static const gchar text_control[] = "<Control>";
|
static const gchar text_control[] = "<Control>";
|
||||||
|
static const gchar text_release[] = "<Release>";
|
||||||
static const gchar text_mod1[] = "<Alt>";
|
static const gchar text_mod1[] = "<Alt>";
|
||||||
static const gchar text_mod2[] = "<Mod2>";
|
static const gchar text_mod2[] = "<Mod2>";
|
||||||
static const gchar text_mod3[] = "<Mod3>";
|
static const gchar text_mod3[] = "<Mod3>";
|
||||||
@ -967,6 +988,8 @@ gtk_accelerator_name (guint accelerator_key,
|
|||||||
l += sizeof (text_shift) - 1;
|
l += sizeof (text_shift) - 1;
|
||||||
if (accelerator_mods & GDK_CONTROL_MASK)
|
if (accelerator_mods & GDK_CONTROL_MASK)
|
||||||
l += sizeof (text_control) - 1;
|
l += sizeof (text_control) - 1;
|
||||||
|
if (accelerator_mods & GDK_RELEASE_MASK)
|
||||||
|
l += sizeof (text_release) - 1;
|
||||||
if (accelerator_mods & GDK_MOD1_MASK)
|
if (accelerator_mods & GDK_MOD1_MASK)
|
||||||
l += sizeof (text_mod1) - 1;
|
l += sizeof (text_mod1) - 1;
|
||||||
if (accelerator_mods & GDK_MOD2_MASK)
|
if (accelerator_mods & GDK_MOD2_MASK)
|
||||||
@ -993,6 +1016,11 @@ gtk_accelerator_name (guint accelerator_key,
|
|||||||
strcpy (accelerator + l, text_control);
|
strcpy (accelerator + l, text_control);
|
||||||
l += sizeof (text_control) - 1;
|
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)
|
if (accelerator_mods & GDK_MOD1_MASK)
|
||||||
{
|
{
|
||||||
strcpy (accelerator + l, text_mod1);
|
strcpy (accelerator + l, text_mod1);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* --- defines --- */
|
/* --- defines --- */
|
||||||
#define BINDING_MOD_MASK() (gtk_accelerator_get_default_mod_mask ())
|
#define BINDING_MOD_MASK() (gtk_accelerator_get_default_mod_mask () | GDK_RELEASE_MASK)
|
||||||
|
|
||||||
|
|
||||||
/* --- variables --- */
|
/* --- variables --- */
|
||||||
|
Loading…
Reference in New Issue
Block a user