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

The hover cursor can appear in S2_1 code in the gtk2 client at times
even when the map is not visible.

For example: center the map so that a city is close to the lower
border of the map visible area. Now open the players tab (F3) and
activate it. Hovering with the mouse in the area of the buttons by the
bottom of the tab (Meet, Intelligence etc) makes the "select city"
cursor appear if you hover over the exact spot where the city is in
the underlying map tab.

Reason for this bug:
leave_mapcanvas(GtkWidget *widget, GdkEventCrossing *event) in
This callback is called at times when it should not actually be
called. A gdb breakpoint and backtrace confirms that it is also called
in the case for this bug.

The fix:
check if the map is really visible. A patch where another check is
added, gtk_widget_is_focus() on map_canvas is attached. I have
verified that this seems to fix the patch but I'm no expert in gtk2.0
so I'm not 100% confident.

Index: client/gui-gtk-2.0/mapctrl.c
--- client/gui-gtk-2.0/mapctrl.c	(revision 12990)
+++ client/gui-gtk-2.0/mapctrl.c	(arbetskopia)
@@ -403,7 +403,8 @@
   gdk_window_get_pointer(map_canvas->window, &canvas_x, &canvas_y, NULL);
   if (map_exists()
       && canvas_x >= 0 && canvas_y >= 0
-      && canvas_x < mapview.width && canvas_y < mapview.height) {
+      && canvas_x < mapview.width && canvas_y < mapview.height
+      && gtk_widget_is_focus(GTK_WIDGET(map_canvas))) {
     handle_mouse_cursor(canvas_pos_to_tile(canvas_x, canvas_y));
     /* update_unit_info_label is handled inside handle_mouse_cursor. */
   } else {
Freeciv-dev mailing list

Reply via email to