Consistent handling of GDK_Return vs GDK_KP_Enter
- From: Jody Goldberg <jgoldberg home com>
- To: gtk-devel-list gnome org
- Subject: Consistent handling of GDK_Return vs GDK_KP_Enter
- Date: Tue, 17 Apr 2001 23:40:14 -0400
Some widgets treat them differently. This leads to problems where
hitting GDK_Enter will activate a GtkEntry but GDK_KP_Enter will
not. Attached are patches for HEAD 1.[23] to clear things up.
Thanks
? gtk+/ID
? gtk+/dup_decl.patch
? gtk+/jconf
Index: gtk+/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1061.2.361
diff -u -w -r1.1061.2.361 ChangeLog
--- gtk+/ChangeLog 2001/04/11 20:22:23 1.1061.2.361
+++ gtk+/ChangeLog 2001/04/18 03:36:36
@@ -1,3 +1,10 @@
+2001-04-17 Jody Goldberg <jgoldberg home com>
+
+ * gtk/gtktext.c (gtk_text_key_press) : Accept Enter on the numeric
+ keypad too.
+ * gtk/gtkmenushell.c (gtk_menu_shell_class_init) : Ditto.
+ * gtk/gtknotebook.c (gtk_notebook_key_press) : Ditto.
+
Wed Apr 11 16:20:00 2001 Owen Taylor <otaylor redhat com>
* gtk/gtklabel.c (gtk_label_parse_uline): Fix check
Index: gtk+/gtk/gtkentry.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
retrieving revision 1.75.2.10
diff -u -w -r1.75.2.10 gtkentry.c
--- gtk+/gtk/gtkentry.c 2001/04/02 03:50:58 1.75.2.10
+++ gtk+/gtk/gtkentry.c 2001/04/18 03:36:37
@@ -1184,6 +1184,7 @@
}
break;
case GDK_Return:
+ case GDK_KP_Enter:
return_val = TRUE;
gtk_widget_activate (widget);
break;
Index: gtk+/gtk/gtkmenushell.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenushell.c,v
retrieving revision 1.27.2.9
diff -u -w -r1.27.2.9 gtkmenushell.c
--- gtk+/gtk/gtkmenushell.c 2001/03/05 21:52:22 1.27.2.9
+++ gtk+/gtk/gtkmenushell.c 2001/04/18 03:36:37
@@ -258,6 +258,11 @@
GTK_TYPE_BOOL,
TRUE);
gtk_binding_entry_add_signal (binding_set,
+ GDK_KP_Enter, 0,
+ "activate_current", 1,
+ GTK_TYPE_BOOL,
+ TRUE);
+ gtk_binding_entry_add_signal (binding_set,
GDK_space, 0,
"activate_current", 1,
GTK_TYPE_BOOL,
Index: gtk+/gtk/gtknotebook.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtknotebook.c,v
retrieving revision 1.65.2.10
diff -u -w -r1.65.2.10 gtknotebook.c
--- gtk+/gtk/gtknotebook.c 2001/01/30 23:27:58 1.65.2.10
+++ gtk+/gtk/gtknotebook.c 2001/04/18 03:36:38
@@ -1369,6 +1369,7 @@
gtk_notebook_switch_focus_tab (notebook, list);
return TRUE;
case GDK_Return:
+ case GDK_KP_Enter:
case GDK_space:
gtk_notebook_page_select (GTK_NOTEBOOK (widget));
return TRUE;
Index: gtk+/gtk/gtktext.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktext.c,v
retrieving revision 1.79.2.11
diff -u -w -r1.79.2.11 gtktext.c
--- gtk+/gtk/gtktext.c 2001/03/15 22:13:21 1.79.2.11
+++ gtk+/gtk/gtktext.c 2001/04/18 03:36:39
@@ -2046,6 +2046,7 @@
case GDK_Up: scroll_int (text, -KEY_SCROLL_PIXELS); break;
case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break;
case GDK_Return:
+ case GDK_KP_Enter:
if (event->state & GDK_CONTROL_MASK)
gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
else
@@ -2152,6 +2153,7 @@
gtk_editable_insert_text (editable, "\t", 1, &position);
break;
case GDK_Return:
+ case GDK_KP_Enter:
if (event->state & GDK_CONTROL_MASK)
gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
else
Index: gtk2/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1899
diff -u -w -r1.1899 ChangeLog
--- gtk2/ChangeLog 2001/04/17 23:21:16 1.1899
+++ gtk2/ChangeLog 2001/04/18 03:37:21
@@ -1,3 +1,13 @@
+2001-04-17 Jody Goldberg <jgoldberg home com>
+
+ * gtk/gtkentry.c (gtk_entry_key_press) : Accept GDK_KP_Enter.
+ * gtk/gtkcolorsel.c (palette_activate) : ditto.
+ * gtk/gtkfontsel.c (gtk_font_selection_size_key_press) : ditto.
+ * gtk/gtkmenushell.c (gtk_menu_shell_class_init) : ditto.
+ * gtk/gtknotebook.c (gtk_notebook_key_press) : ditto.
+ * gtk/gtktext.c (gtk_text_key_press) : ditto.
+ * gtk/gtktextview.c (gtk_text_view_key_press_event) : Ditto.
+
Tue Apr 17 18:05:34 2001 Owen Taylor <otaylor redhat com>
* Released 1.3.4
Index: gtk2/gtk/gtkcolorsel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcolorsel.c,v
retrieving revision 1.63
diff -u -w -r1.63 gtkcolorsel.c
--- gtk2/gtk/gtkcolorsel.c 2001/03/24 06:10:39 1.63
+++ gtk2/gtk/gtkcolorsel.c 2001/04/18 03:37:22
@@ -790,7 +790,9 @@
GtkColorSelection *colorsel = data;
ColorSelectionPrivate *priv;
- if ((event->keyval == ' ') || (event->keyval == GDK_Return))
+ if ((event->keyval == ' ') ||
+ (event->keyval == GDK_Return) ||
+ (event->keyval == GDK_KP_Enter))
{
priv = colorsel->private_data;
palette_set_color (widget, GTK_COLOR_SELECTION (data), priv->color);
Index: gtk2/gtk/gtkentry.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
retrieving revision 1.123
diff -u -w -r1.123 gtkentry.c
--- gtk2/gtk/gtkentry.c 2001/04/02 23:33:40 1.123
+++ gtk2/gtk/gtkentry.c 2001/04/18 03:37:23
@@ -1463,7 +1463,7 @@
/* Activate key bindings
*/
return TRUE;
- else if (event->keyval == GDK_Return)
+ else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter)
{
gtk_widget_activate (widget);
return TRUE;
Index: gtk2/gtk/gtkfontsel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfontsel.c,v
retrieving revision 1.47
diff -u -w -r1.47 gtkfontsel.c
--- gtk2/gtk/gtkfontsel.c 2001/03/24 06:10:39 1.47
+++ gtk2/gtk/gtkfontsel.c 2001/04/18 03:37:23
@@ -713,7 +713,7 @@
fontsel = GTK_FONT_SELECTION (data);
- if (event->keyval == GDK_Return)
+ if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter)
{
text = gtk_entry_get_text (GTK_ENTRY (fontsel->size_entry));
new_size = atoi (text) * PANGO_SCALE;
Index: gtk2/gtk/gtkmenushell.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenushell.c,v
retrieving revision 1.42
diff -u -w -r1.42 gtkmenushell.c
--- gtk2/gtk/gtkmenushell.c 2001/04/01 07:32:39 1.42
+++ gtk2/gtk/gtkmenushell.c 2001/04/18 03:37:23
@@ -262,6 +262,11 @@
GTK_TYPE_BOOL,
TRUE);
gtk_binding_entry_add_signal (binding_set,
+ GDK_KP_Enter, 0,
+ "activate_current", 1,
+ GTK_TYPE_BOOL,
+ TRUE);
+ gtk_binding_entry_add_signal (binding_set,
GDK_space, 0,
"activate_current", 1,
GTK_TYPE_BOOL,
Index: gtk2/gtk/gtknotebook.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtknotebook.c,v
retrieving revision 1.86
diff -u -w -r1.86 gtknotebook.c
--- gtk2/gtk/gtknotebook.c 2001/04/01 07:32:39 1.86
+++ gtk2/gtk/gtknotebook.c 2001/04/18 03:37:24
@@ -1258,6 +1258,7 @@
gtk_notebook_switch_focus_tab (notebook, list);
return TRUE;
case GDK_Return:
+ case GDK_KP_Enter:
gtk_notebook_page_select (GTK_NOTEBOOK (widget), TRUE);
return TRUE;
case GDK_space:
Index: gtk2/gtk/gtktext.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktext.c,v
retrieving revision 1.99
diff -u -w -r1.99 gtktext.c
--- gtk2/gtk/gtktext.c 2001/03/24 06:10:40 1.99
+++ gtk2/gtk/gtktext.c 2001/04/18 03:37:25
@@ -1934,6 +1934,7 @@
case GDK_Up: scroll_int (text, -KEY_SCROLL_PIXELS); break;
case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break;
case GDK_Return:
+ case GDK_KP_Enter:
if (event->state & GDK_CONTROL_MASK)
gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
else
@@ -2040,6 +2041,7 @@
gtk_editable_insert_text (GTK_EDITABLE (old_editable), "\t", 1, &position);
break;
case GDK_Return:
+ case GDK_KP_Enter:
if (event->state & GDK_CONTROL_MASK)
gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
else
Index: gtk2/gtk/gtktextview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
retrieving revision 1.79
diff -u -w -r1.79 gtktextview.c
--- gtk2/gtk/gtktextview.c 2001/04/17 23:21:17 1.79
+++ gtk2/gtk/gtktextview.c 2001/04/18 03:37:27
@@ -2951,7 +2951,7 @@
else if (GTK_WIDGET_CLASS (parent_class)->key_press_event &&
GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event))
retval = TRUE;
- else if (event->keyval == GDK_Return)
+ else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter)
{
gtk_text_buffer_insert_interactive_at_cursor (get_buffer (text_view), "\n", 1,
text_view->editable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]