Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10192) About detachable panes
Home

[Freeciv-Dev] (PR#10192) About detachable panes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mstefek@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#10192) About detachable panes
From: "Vasco Alexandre da Silva Costa via RT" <vasc@xxxxxxxxxxxxxx>
Date: Fri, 24 Sep 2004 11:51:46 -0700
Reply-to: RT_CorrespondAddressNotSet@xxxxxxxxxxxxxx

<URL: http://RT::WebBaseURL.not.configured:80/Ticket/Display.html?id=10192 >

> [mstefek - Sun Sep 19 17:39:02 2004]:
> 
> Keyboard bindings doesn't work when detached panes have focus. I'm
> talking about such shortcuts as [F6].
> The simples solution is making them use the same GtkAccelGroup as the
> main window (probably).

This is the simplest patch I can come up with which does the trick.



Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.80
diff -u -r1.80 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       23 Sep 2004 20:48:08 -0000      1.80
+++ client/gui-gtk-2.0/gui_main.c       24 Sep 2004 18:51:00 -0000
@@ -421,6 +421,15 @@
 }
 
 /**************************************************************************
+ propagates a keypress in a tearoff back to the toplevel window.
+**************************************************************************/
+static gboolean propagate_keypress(GtkWidget *w, GdkEventKey *ev)
+{
+  gtk_widget_event(toplevel, (GdkEvent *)ev);
+  return FALSE;
+}
+
+/**************************************************************************
  callback for the toggle button in the detachable widget: causes the
  widget to detach or reattach.
 **************************************************************************/
@@ -436,7 +445,10 @@
     gtk_window_set_title(GTK_WINDOW(w), _("Freeciv"));
     gtk_window_set_position(GTK_WINDOW(w), GTK_WIN_POS_MOUSE);
     g_signal_connect(w, "destroy", G_CALLBACK(tearoff_destroy), box);
-    
+    g_signal_connect(w, "key_press_event",
+       G_CALLBACK(propagate_keypress), NULL);
+
+
     g_object_set_data(G_OBJECT(w), "parent", box->parent);
     g_object_set_data(G_OBJECT(w), "toggle", b);
     gtk_widget_reparent(box, w);

[Prev in Thread] Current Thread [Next in Thread]