From 0509519d35c31c25bd225e1d68ca66e11802d46b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 12 Feb 2008 15:51:09 +0000 Subject: [PATCH] Unify the handling of various "Enter" keysyms all over the place. 2008-02-12 Matthias Clasen * gtk/*.c: Unify the handling of various "Enter" keysyms all over the place. (#515047, Christian Persch) svn path=/trunk/; revision=19528 --- ChangeLog | 5 +++++ gtk/gtkaboutdialog.c | 3 ++- gtk/gtkcolorsel.c | 2 ++ gtk/gtkcombo.c | 4 +++- gtk/gtkcombobox.c | 6 ++++-- gtk/gtkdnd.c | 1 + gtk/gtkentry.c | 2 ++ gtk/gtkfilechooserdefault.c | 3 ++- gtk/gtkiconview.c | 4 ++++ gtk/gtkmenushell.c | 5 +++++ gtk/gtkpaned.c | 3 +++ gtk/gtkscalebutton.c | 2 ++ gtk/gtktext.c | 2 ++ gtk/gtktextview.c | 1 + gtk/gtktreeview.c | 5 +++++ gtk/gtkwindow.c | 5 +++-- 16 files changed, 46 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65d5ba01d4..520d1331d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-12 Matthias Clasen + + * gtk/*.c: Unify the handling of various "Enter" keysyms + all over the place. (#515047, Christian Persch) + 2008-02-12 Matthias Clasen * gtk/gtkfilesystemmodel.c: diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index f57a474e57..0430d01735 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -1718,7 +1718,8 @@ credits_key_press_event (GtkWidget *text_view, switch (event->keyval) { - case GDK_Return: + case GDK_Return: + case GDK_ISO_Enter: case GDK_KP_Enter: buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)); gtk_text_buffer_get_iter_at_mark (buffer, &iter, diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 29d828189e..859d55fae4 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -1066,6 +1066,7 @@ palette_activate (GtkWidget *widget, /* should have a drawing area subclass with an activate signal */ if ((event->keyval == GDK_space) || (event->keyval == GDK_Return) || + (event->keyval == GDK_ISO_Enter) || (event->keyval == GDK_KP_Enter) || (event->keyval == GDK_KP_Space)) { @@ -1327,6 +1328,7 @@ key_press (GtkWidget *invisible, { case GDK_space: case GDK_Return: + case GDK_ISO_Enter: case GDK_KP_Enter: case GDK_KP_Space: grab_color_at_mouse (screen, x, y, data); diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index b3f2fd59c4..552b738bb6 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -293,7 +293,9 @@ gtk_combo_window_key_press (GtkWidget *window, { guint state = event->state & gtk_accelerator_get_default_mod_mask (); - if ((event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) && + if ((event->keyval == GDK_Return || + event->keyval == GDK_ISO_Enter || + event->keyval == GDK_KP_Enter) && state == 0) { gtk_combo_popdown_list (combo); diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index b8d16f3c2d..a43a0c9234 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -3865,7 +3865,7 @@ gtk_combo_box_list_key_press (GtkWidget *widget, GtkComboBox *combo_box = GTK_COMBO_BOX (data); GtkTreeIter iter; - if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter || + if (event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter || event->keyval == GDK_KP_Enter || event->keyval == GDK_space || event->keyval == GDK_KP_Space) { GtkTreeModel *model = NULL; @@ -5344,7 +5344,9 @@ gtk_cell_editable_key_press (GtkWidget *widget, return TRUE; } - else if (event->keyval == GDK_Return) + else if (event->keyval == GDK_Return || + event->keyval == GDK_ISO_Enter || + event->keyval == GDK_KP_Enter) { gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box)); gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box)); diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 49000f3b63..87f4db43f1 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -4077,6 +4077,7 @@ gtk_drag_key_cb (GtkWidget *widget, case GDK_space: case GDK_Return: + case GDK_ISO_Enter: case GDK_KP_Enter: case GDK_KP_Space: gtk_drag_end (info, event->time); diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 2ccdfad3d0..c8b71e5316 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -820,6 +820,8 @@ gtk_entry_class_init (GtkEntryClass *class) */ gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "activate", 0); + gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, + "activate", 0); gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "activate", 0); diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index de809d0106..08971f8b9d 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -4078,7 +4078,8 @@ trap_activate_cb (GtkWidget *widget, if ((event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter || event->keyval == GDK_KP_Enter - || event->keyval == GDK_space) + || event->keyval == GDK_space + || event->keyval == GDK_KP_Space) && ((event->state & modifiers) == 0) && !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)) diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 6ad5f05ea7..cc2c241fd3 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -870,9 +870,13 @@ gtk_icon_view_class_init (GtkIconViewClass *klass) "unselect_all", 0); gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK, "toggle_cursor_item", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, GDK_CONTROL_MASK, + "toggle_cursor_item", 0); gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "activate_cursor_item", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0, + "activate_cursor_item", 0); gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "activate_cursor_item", 0); gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index f6d10a49ce..603eb6048f 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -324,6 +324,11 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass) "activate_current", 1, G_TYPE_BOOLEAN, TRUE); + gtk_binding_entry_add_signal (binding_set, + GDK_ISO_Enter, 0, + "activate_current", 1, + G_TYPE_BOOLEAN, + TRUE); gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "activate_current", 1, diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 30053da25a..2961dafb8c 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -478,6 +478,9 @@ gtk_paned_class_init (GtkPanedClass *class) gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "accept_position", 0); + gtk_binding_entry_add_signal (binding_set, + GDK_ISO_Enter, 0, + "accept_position", 0); gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "accept_position", 0); diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index 28f6c0101b..99cc4c8bfc 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -297,6 +297,8 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass) gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "popup", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0, + "popup", 0); gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "popup", 0); gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 4cb62fe4ce..704a04bfde 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1909,6 +1909,7 @@ gtk_text_key_press (GtkWidget *widget, case GDK_KP_Down: case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break; case GDK_Return: + case GDK_ISO_Enter: case GDK_KP_Enter: if (event->state & GDK_CONTROL_MASK) gtk_signal_emit_by_name (GTK_OBJECT (text), "activate"); @@ -2028,6 +2029,7 @@ gtk_text_key_press (GtkWidget *widget, gtk_editable_insert_text (GTK_EDITABLE (old_editable), "\t", 1, &position); break; case GDK_KP_Enter: + case GDK_ISO_Enter: case GDK_Return: if (event->state & GDK_CONTROL_MASK) gtk_signal_emit_by_name (GTK_OBJECT (text), "activate"); diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 593467282b..05bec7ddc5 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -4094,6 +4094,7 @@ gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event) /* use overall editability not can_insert, more predictable for users */ else if (text_view->editable && (event->keyval == GDK_Return || + event->keyval == GDK_ISO_Enter || event->keyval == GDK_KP_Enter)) { /* this won't actually insert the newline if the cursor isn't diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 070d5fc2b1..06a4a77b22 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -1165,6 +1165,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) G_TYPE_INT, -1); gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK, "toggle_cursor_row", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, GDK_CONTROL_MASK, "toggle_cursor_row", 0); gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK, "select_all", 0); gtk_binding_entry_add_signal (binding_set, GDK_slash, GDK_CONTROL_MASK, "select_all", 0); @@ -1174,9 +1175,13 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_SHIFT_MASK, "select_cursor_row", 1, G_TYPE_BOOLEAN, TRUE); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, GDK_SHIFT_MASK, "select_cursor_row", 1, + G_TYPE_BOOLEAN, TRUE); gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "select_cursor_row", 1, G_TYPE_BOOLEAN, TRUE); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0, "select_cursor_row", 1, + G_TYPE_BOOLEAN, TRUE); gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "select_cursor_row", 1, G_TYPE_BOOLEAN, TRUE); gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, "select_cursor_row", 1, diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index f31f5c9e80..04dc992f3b 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -826,7 +826,8 @@ gtk_window_class_init (GtkWindowClass *klass) gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "activate_default", 0); - + gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, + "activate_default", 0); gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "activate_default", 0); @@ -4877,7 +4878,7 @@ _gtk_window_query_nonaccels (GtkWindow *window, if (!accel_mods) { static const guint bindings[] = { - GDK_space, GDK_KP_Space, GDK_Return, GDK_KP_Enter, GDK_Up, GDK_KP_Up, GDK_Down, GDK_KP_Down, + GDK_space, GDK_KP_Space, GDK_Return, GDK_ISO_Enter, GDK_KP_Enter, GDK_Up, GDK_KP_Up, GDK_Down, GDK_KP_Down, GDK_Left, GDK_KP_Left, GDK_Right, GDK_KP_Right, GDK_Tab, GDK_KP_Tab, GDK_ISO_Left_Tab, }; guint i;