Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2006:
[Freeciv-Dev] (PR#15850) 1, 2, 3, and 4 keys don't move unit
Home

[Freeciv-Dev] (PR#15850) 1, 2, 3, and 4 keys don't move unit

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: joseph@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#15850) 1, 2, 3, and 4 keys don't move unit
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Wed, 24 May 2006 03:02:13 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15850 >

> [joseph@xxxxxxxxx - Sa 11. Mär 2006, 05:46:16]:
> 
> hmm - i see that the arrow keys now work as expected - could perhaps
> home, end, pgup, and pgdn be used to round out the diagonal direction
> keys and then we wouldn't need to use the number keys at all for movement?
> 
> joe

Here's a patch which implements this. PgUp and PgDown were previously
used to scroll the message window. With this patch that functionality
moves to Shift+PgUp and Shift+PgDown.
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
--- client/gui-gtk-2.0/gui_main.c       (Revision 11992)
+++ client/gui-gtk-2.0/gui_main.c       (Arbeitskopie)
@@ -452,17 +452,6 @@
     return FALSE;
   }
 
-  if (ev->keyval == GDK_Page_Up) {
-    g_signal_emit_by_name(main_message_area, "move_cursor",
-                         GTK_MOVEMENT_PAGES, -1, FALSE);
-    return TRUE;
-  }
-  if (ev->keyval == GDK_Page_Down) {
-    g_signal_emit_by_name(main_message_area, "move_cursor",
-                         GTK_MOVEMENT_PAGES, 1, FALSE);
-    return TRUE;
-  }
-
   if (!client_is_observer()) { /* FIXME: is this check right? */
     if ((ev->state & GDK_SHIFT_MASK)) {
       switch (ev->keyval) {
@@ -490,6 +479,16 @@
        case GDK_KP_Enter:
          key_end_turn();
          return TRUE;
+
+        case GDK_Page_Up:
+          g_signal_emit_by_name(main_message_area, "move_cursor",
+                         GTK_MOVEMENT_PAGES, -1, FALSE);
+          return TRUE;
+
+        case GDK_Page_Down:
+          g_signal_emit_by_name(main_message_area, "move_cursor",
+                         GTK_MOVEMENT_PAGES, 1, FALSE);
+          return TRUE;
   
        default:
          break;
@@ -498,20 +497,36 @@
 
     if (GTK_WIDGET_HAS_FOCUS(map_canvas)) {
       switch (ev->keyval) {
-       case GDK_Left:
-         key_unit_move(DIR8_WEST);
-         return TRUE;
+        case GDK_Up:
+          key_unit_move(DIR8_NORTH);
+          return TRUE;
 
-       case GDK_Right:
-         key_unit_move(DIR8_EAST);
-         return TRUE;
+        case GDK_Page_Up:
+          key_unit_move(DIR8_NORTHEAST);
+          return TRUE;
 
-       case GDK_Up:
-         key_unit_move(DIR8_NORTH);
-         return TRUE;
+        case GDK_Right:
+          key_unit_move(DIR8_EAST);
+          return TRUE;
 
-       case GDK_Down:
-         key_unit_move(DIR8_SOUTH);
+        case GDK_Page_Down:
+          key_unit_move(DIR8_SOUTHEAST);
+          return TRUE;
+
+        case GDK_Down:
+          key_unit_move(DIR8_SOUTH);
+          return TRUE;
+
+        case GDK_End:
+          key_unit_move(DIR8_SOUTHWEST);
+          return TRUE;
+      
+        case GDK_Left:
+          key_unit_move(DIR8_WEST);
+          return TRUE;
+
+        case GDK_Home:         
+          key_unit_move(DIR8_NORTHWEST);
          return TRUE;
 
        default:

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#15850) 1, 2, 3, and 4 keys don't move unit, Christian Prochaska <=