patch to use KP_keys on entries



This is a patch for using the KP_keys on entries (againts gtk+-1.2.6)

Although it works, there are some problems (with modifiers keys):

For example, if I press: Shift+Right, then the character to the right is
selected (as expected).
But if I press: Shift+KP_Right, then I obtain a "6" (not expected, at
least for me). Then same for Shift+{KP_Left,KP_Home,KP_End},... and for
Ctrl+{KP_Left,...}
I understand that when I press Shift+KP_Right (for example), the
GDK layer changes it to be "6" and not Shift+KP_Right, and that way, the
key_press_event handler of gtkentry.c can't work properly.

The question is: Is there any way to avoid this? Any field in the event
data structure?
I know that it can be done, because kwrite (yes, I know, a KDE program)
does it properly.
--- ../joder/gtk+-1.2.6/gtk/gtkentry.c	Mon Aug 23 21:40:33 1999
+++ gtkentry.c	Wed Feb  9 18:30:30 2000
@@ -1063,6 +1063,7 @@
       return_val = TRUE;
       gtk_delete_line (entry);
       break;
+    case GDK_KP_Insert:
     case GDK_Insert:
       return_val = TRUE;
       if (event->state & GDK_SHIFT_MASK)
@@ -1079,6 +1080,7 @@
 	  /* gtk_toggle_insert(entry) -- IMPLEMENT */
 	}
       break;
+    case GDK_KP_Delete:
     case GDK_Delete:
       return_val = TRUE;
       if (event->state & GDK_CONTROL_MASK)
@@ -1091,14 +1093,17 @@
       else
 	gtk_delete_forward_character (entry);
       break;
+    case GDK_KP_Home:
     case GDK_Home:
       return_val = TRUE;
       gtk_move_beginning_of_line (entry);
       break;
+    case GDK_KP_End:
     case GDK_End:
       return_val = TRUE;
       gtk_move_end_of_line (entry);
       break;
+    case GDK_KP_Left:
     case GDK_Left:
       return_val = TRUE;
       if (event->state & GDK_CONTROL_MASK)
@@ -1106,6 +1111,7 @@
       else
 	gtk_move_backward_character (entry);
       break;
+    case GDK_KP_Right:
     case GDK_Right:
       return_val = TRUE;
       if (event->state & GDK_CONTROL_MASK)
@@ -1113,6 +1119,7 @@
       else
 	gtk_move_forward_character (entry);
       break;
+    case GDK_KP_Enter:
     case GDK_Return:
       return_val = TRUE;
       gtk_widget_activate (widget);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]