diff options
author | Tim Janik <timj@gtk.org> | 1998-06-30 08:02:53 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-06-30 08:02:53 +0000 |
commit | bf44f089cd6e9a613dd5b6a08fee66e14df347e1 (patch) | |
tree | 3227491f381fbdb272e8a5767dc203e8aac8c17c /gtk | |
parent | 1d82cc2f2ed92395635e9cce3d628ddd0e8696d1 (diff) | |
download | gtk+-bf44f089cd6e9a613dd5b6a08fee66e14df347e1.tar.gz |
implemented default handler for key-release events, which checks for
Tue Jun 30 09:24:40 1998 Tim Janik <timj@gtk.org>
* 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')
-rw-r--r-- | gtk/gtkwidget.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 51b7b86b7d..18404fb319 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -186,6 +186,8 @@ static void gtk_widget_real_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gint gtk_widget_real_key_press_event (GtkWidget *widget, GdkEventKey *event); +static gint gtk_widget_real_key_release_event (GtkWidget *widget, + GdkEventKey *event); static void gtk_widget_style_set (GtkWidget *widget, GtkStyle *previous_style); @@ -720,7 +722,7 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->destroy_event = NULL; klass->expose_event = NULL; klass->key_press_event = gtk_widget_real_key_press_event; - klass->key_release_event = NULL; + klass->key_release_event = gtk_widget_real_key_release_event; klass->enter_notify_event = NULL; klass->leave_notify_event = NULL; klass->configure_event = NULL; @@ -749,8 +751,8 @@ gtk_widget_class_init (GtkWidgetClass *klass) GtkBindingSet *binding_set; binding_set = gtk_binding_set_by_class (klass); - gtk_binding_entry_add_signal (binding_set, '9', GDK_CONTROL_MASK, "hide", 0); - gtk_binding_entry_add_signal (binding_set, '9', GDK_CONTROL_MASK, "show", 0); + gtk_binding_entry_add_signal (binding_set, '9', GDK_CONTROL_MASK|GDK_RELEASE_MASK, "hide", 0); + gtk_binding_entry_add_signal (binding_set, '9', GDK_CONTROL_MASK|GDK_RELEASE_MASK, "show", 0); } } @@ -1956,7 +1958,26 @@ gtk_widget_real_key_press_event (GtkWidget *widget, if (!handled) handled = gtk_bindings_activate (GTK_OBJECT (widget), - event->keyval, event->state); + event->keyval, + event->state); + + return handled; +} + +static gint +gtk_widget_real_key_release_event (GtkWidget *widget, + GdkEventKey *event) +{ + gboolean handled = FALSE; + + g_return_val_if_fail (widget != NULL, handled); + g_return_val_if_fail (GTK_IS_WIDGET (widget), handled); + g_return_val_if_fail (event != NULL, handled); + + if (!handled) + handled = gtk_bindings_activate (GTK_OBJECT (widget), + event->keyval, + event->state | GDK_RELEASE_MASK); return handled; } |