Unify the handling of various "Enter" keysyms all over the place.

2008-02-12  Matthias Clasen  <mclasen@redhat.com>

        * gtk/*.c: Unify the handling of various "Enter" keysyms
        all over the place.  (#515047, Christian Persch)



svn path=/trunk/; revision=19528
This commit is contained in:
Matthias Clasen 2008-02-12 15:51:09 +00:00 committed by Matthias Clasen
parent f51751d2d8
commit 0509519d35
16 changed files with 46 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2008-02-12 Matthias Clasen <mclasen@redhat.com>
* gtk/*.c: Unify the handling of various "Enter" keysyms
all over the place. (#515047, Christian Persch)
2008-02-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilesystemmodel.c:

View File

@ -1719,6 +1719,7 @@ credits_key_press_event (GtkWidget *text_view,
switch (event->keyval)
{
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,

View File

@ -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);

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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);

View File

@ -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))

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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,

View File

@ -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");

View File

@ -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

View File

@ -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,

View File

@ -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;