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

Turns out that tab/dialog windows use standard parts for Cancel/Close
called GTK_STOCK_CANCEL and GTK_RESPONSE_CANCEL, and somehow this
automatically binds the <escape> key to the window.  So, this proposal
cannot be done.  Sorry.

Hitting <escape> a lot will eventually close all the other windows,
bringing back the Map again....

However, I searched for an alternative, and the <control>+<return>
combination isn't being used.  I've tested it, seems to work well.

Not as easy as <escape> would have been, but bringing the Map back into
focus seems sufficiently worthy to warrant this special consideration.



Index: client/gui-gtk-2.0/gui_main.c
===================================================================
--- client/gui-gtk-2.0/gui_main.c       (revision 14160)
+++ client/gui-gtk-2.0/gui_main.c       (working copy)
@@ -632,7 +632,8 @@
     return FALSE;
   }
 
-  if ((ev->state & GDK_SHIFT_MASK)) {
+  if ((ev->state & GDK_CONTROL_MASK)) {
+  } else if ((ev->state & GDK_SHIFT_MASK)) {
     switch (ev->keyval) {
 
     case GDK_Return:
@@ -643,6 +644,7 @@
     default:
       break;
     };
+  } else {
   }
 
   switch (ev->keyval) {
@@ -665,6 +667,23 @@
     return keyboard_map_canvas(w, ev, data);
   }
 
+  /* We are focused some other dialog, tab, or widget. */
+  if ((ev->state & GDK_CONTROL_MASK)) {
+    switch (ev->keyval) {
+
+    case GDK_Return:
+    case GDK_KP_Enter:
+      gtk_notebook_set_current_page(GTK_NOTEBOOK(top_notebook), 0);
+      gtk_widget_grab_focus(map_canvas);
+      return TRUE;
+
+    default:
+      break;
+    };
+  } else if ((ev->state & GDK_SHIFT_MASK)) {
+  } else {
+  }
+
   return FALSE;
 }
 
@@ -1161,7 +1180,7 @@
 
   map_widget = gtk_table_new(2, 2, FALSE);
 
-  label = gtk_label_new_with_mnemonic(_("_Map"));
+  label = gtk_label_new(_("Map"));
   gtk_notebook_append_page(GTK_NOTEBOOK(top_notebook), map_widget, label);
 
   frame = gtk_frame_new(NULL);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to