From fc8d9dc2bdd0f9f2be8a08dd7e9c76283d779817 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 30 Aug 2005 18:38:17 +0000 Subject: [PATCH] Add key bindings to make C-/ select all and C-\ unselect all. (#309301, 2005-08-30 Matthias Clasen * gtk/gtkentry.c (gtk_entry_class_init): Add key bindings to make C-/ select all and C-\ unselect all. (#309301, Kathy Fernandez) --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ gtk/gtkentry.c | 25 +++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80397d9ff6..22e618392f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-08-30 Matthias Clasen + * gtk/gtkentry.c (gtk_entry_class_init): Add key bindings to + make C-/ select all and C-\ unselect all. (#309301, + Kathy Fernandez) + * gtk/gtkimcontextsimple.c: Change the compose sequence for soft hyphen to be multi_key-minus-minus-space, and add compose sequences multi_key-minus-minus-period and diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 80397d9ff6..22e618392f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2005-08-30 Matthias Clasen + * gtk/gtkentry.c (gtk_entry_class_init): Add key bindings to + make C-/ select all and C-\ unselect all. (#309301, + Kathy Fernandez) + * gtk/gtkimcontextsimple.c: Change the compose sequence for soft hyphen to be multi_key-minus-minus-space, and add compose sequences multi_key-minus-minus-period and diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index c3d340aafe..c4757c0d63 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -763,8 +763,25 @@ gtk_entry_class_init (GtkEntryClass *class) "move_cursor", 3, GTK_TYPE_MOVEMENT_STEP, GTK_MOVEMENT_BUFFER_ENDS, G_TYPE_INT, 1, - G_TYPE_BOOLEAN, TRUE); + G_TYPE_BOOLEAN, TRUE); + gtk_binding_entry_add_signal (binding_set, GDK_slash, GDK_CONTROL_MASK, + "move_cursor", 3, + GTK_TYPE_MOVEMENT_STEP, GTK_MOVEMENT_BUFFER_ENDS, + G_TYPE_INT, -1, + G_TYPE_BOOLEAN, FALSE); + gtk_binding_entry_add_signal (binding_set, GDK_slash, GDK_CONTROL_MASK, + "move_cursor", 3, + GTK_TYPE_MOVEMENT_STEP, GTK_MOVEMENT_BUFFER_ENDS, + G_TYPE_INT, 1, + G_TYPE_BOOLEAN, TRUE); + /* Unselect all + */ + gtk_binding_entry_add_signal (binding_set, GDK_backslash, GDK_CONTROL_MASK, + "move_cursor", 3, + GTK_TYPE_MOVEMENT_STEP, GTK_MOVEMENT_VISUAL_POSITIONS, + G_TYPE_INT, 0, + G_TYPE_BOOLEAN, FALSE); /* Activate */ @@ -1378,7 +1395,7 @@ gtk_entry_draw_frame (GtkWidget *widget) gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), NULL, widget, "entry", - x, y, width, height); + 0, 0, width, height); } } @@ -2400,9 +2417,9 @@ gtk_entry_move_cursor (GtkEntry *entry, gint current_x = get_better_cursor_x (entry, entry->current_pos); gint bound_x = get_better_cursor_x (entry, entry->selection_bound); - if (count < 0) + if (count <= 0) new_pos = current_x < bound_x ? entry->current_pos : entry->selection_bound; - else + else new_pos = current_x > bound_x ? entry->current_pos : entry->selection_bound; break;