Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] (PR#3945) butt_down_wakeup never called
Home

[Freeciv-Dev] (PR#3945) butt_down_wakeup never called

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#3945) butt_down_wakeup never called
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Apr 2003 21:37:05 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Comments in the code indicate that <SHIFT>+<LMB> should result in all
units on the tile being woken up.  gui-gtk-2.0 has a butt_down_wakeup
callback for this functionality.  This code is _very_ old (pre-CVS).

But this function is never called.  The button_press_event is always [1]
handled by butt_down_mapcanvas() instead, which returns TRUE so there's
no further handling.  And <SHIFT>+<LMB> has been usurped to adjust
workers on the tile instead.

This patch removes the butt_down_wakeup function, and calls
wakeup_button_pressed directly from butt_down_mapcanvas.  It keeps the
<SHIFT>+<LMB> functionality.  Note that this is what gui-win32 also
does.  It might make more sense to rebind this to <SHIFT>+<RMB> instead
(in which case gui-win32 and the button_down_wakeup button should also
be changed).

This patch is for gui-gtk-2.0, but should also be applied to gui-gtk.

[1] Assuming that butt_down_mapcanvas, since it is assigned first, is
always called first.  There's no reason this should always be true
AFAIK...it's possible some versions of GTK will reverse it, and so mouse
buttons will never work!

jason

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.50
diff -u -r1.50 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       2003/03/29 09:57:37     1.50
+++ client/gui-gtk-2.0/gui_main.c       2003/04/07 04:28:28
@@ -854,9 +854,6 @@
   g_signal_connect(toplevel, "key_press_event",
                    G_CALLBACK(keyboard_handler), NULL);
 
-  g_signal_connect(map_canvas, "button_press_event",
-                   G_CALLBACK(butt_down_wakeup), NULL);
-
   /* *** The message window -- this is a detachable widget *** */
 
   ahbox = detached_widget_new();
Index: client/gui-gtk-2.0/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapctrl.c,v
retrieving revision 1.20
diff -u -r1.20 mapctrl.c
--- client/gui-gtk-2.0/mapctrl.c        2003/04/06 21:52:24     1.20
+++ client/gui-gtk-2.0/mapctrl.c        2003/04/07 04:28:28
@@ -281,21 +281,7 @@
   gtk_widget_set_sensitive(turn_done_button, state);
 }
 
-
 /**************************************************************************
-(RP:) wake up my own sentried units on the tile that was clicked
-**************************************************************************/
-gboolean butt_down_wakeup(GtkWidget *w, GdkEventButton *ev, gpointer data)
-{
-  /* when you get a <SHIFT>+<LMB> pow! */
-  if (ev->state & GDK_SHIFT_MASK) {
-    wakeup_button_pressed(ev->x, ev->y);
-  }
-
-  return TRUE;
-}
-
-/**************************************************************************
 ...
 **************************************************************************/
 gboolean butt_down_mapcanvas(GtkWidget *w, GdkEventButton *ev, gpointer data)
@@ -309,6 +295,7 @@
 
   if (ev->button == 1 && (ev->state & GDK_SHIFT_MASK)) {
     adjust_workers_button_pressed(ev->x, ev->y);
+    wakeup_button_pressed(ev->x, ev->y);
     return TRUE;
   }
 
Index: client/gui-gtk-2.0/mapctrl.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapctrl.h,v
retrieving revision 1.4
diff -u -r1.4 mapctrl.h
--- client/gui-gtk-2.0/mapctrl.h        2003/04/06 21:52:24     1.4
+++ client/gui-gtk-2.0/mapctrl.h        2003/04/07 04:28:28
@@ -22,7 +22,6 @@
 void key_city_workers(GtkWidget *w, GdkEventKey *ev);
 
 gboolean butt_down_mapcanvas(GtkWidget *w, GdkEventButton *ev, gpointer data);
-gboolean butt_down_wakeup(GtkWidget *w, GdkEventButton *ev, gpointer data);
 gboolean butt_down_overviewcanvas(GtkWidget *w, GdkEventButton *ev, gpointer 
data);
 gboolean move_mapcanvas(GtkWidget *widget, GdkEventMotion *event, gpointer 
data);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#3945) butt_down_wakeup never called, Jason Short <=