Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#14416) selection rectangle update bugs
Home

[Freeciv-Dev] (PR#14416) selection rectangle update bugs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#14416) selection rectangle update bugs
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Oct 2005 19:11:16 -0700
Reply-to: bugs@xxxxxxxxxxx

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

The selection rectangle isn't updated when things are redrawn.

This patch fixes it.

-jason

Index: client/gui-gtk-2.0/mapview.c
===================================================================
--- client/gui-gtk-2.0/mapview.c        (revision 11168)
+++ client/gui-gtk-2.0/mapview.c        (working copy)
@@ -366,6 +366,7 @@
 static gint unqueue_flush(gpointer data)
 {
   flush_dirty();
+  redraw_selection_rectangle();
   is_flush_queued = FALSE;
   return 0;
 }
@@ -770,8 +771,6 @@
   points[4].x = canvas_x;
   points[4].y = canvas_y;
   gdk_draw_lines(map_canvas->window, civ_gc, points, ARRAY_SIZE(points));
-
-  rectangle_active = TRUE;
 }
 
 /**************************************************************************
Index: client/gui-xaw/mapview.c
===================================================================
--- client/gui-xaw/mapview.c    (revision 11168)
+++ client/gui-xaw/mapview.c    (working copy)
@@ -533,6 +533,7 @@
 static void unqueue_flush(XtPointer client_data, XtIntervalId * id)
 {
   flush_dirty();
+  redraw_selection_rectangle();
   is_flush_queued = FALSE;
 }
 
Index: client/gui-win32/mapview.c
===================================================================
--- client/gui-win32/mapview.c  (revision 11168)
+++ client/gui-win32/mapview.c  (working copy)
@@ -303,6 +303,7 @@
                                   DWORD dwTime)
 {
   flush_dirty();
+  redraw_selection_rectangle();
   is_flush_queued = FALSE;
 }
 
Index: client/packhand.c
===================================================================
--- client/packhand.c   (revision 11168)
+++ client/packhand.c   (working copy)
@@ -266,7 +266,6 @@
 **************************************************************************/
 void handle_nuke_tile_info(int x, int y)
 {
-  flush_dirty();
   put_nuke_mushroom_pixmaps(map_pos_to_tile(x, y));
 }
 
@@ -302,7 +301,6 @@
                       unit_type(punit1)->sound_fight_alt);
 
       if (do_combat_animation) {
-       flush_dirty();
        decrease_unit_hp_smooth(punit0, hp0, punit1, hp1);
       } else {
        punit0->hp = hp0;
Index: client/gui-ftwl/mapview.c
===================================================================
--- client/gui-ftwl/mapview.c   (revision 11168)
+++ client/gui-ftwl/mapview.c   (working copy)
@@ -840,6 +840,7 @@
            dy, new_x, new_y);
     set_mapview_scroll_pos(new_x, new_y);
     flush_dirty();
+    redraw_selection_rectangle();
     clear_timer_start(drag_timer);
   }
 }
@@ -987,6 +988,7 @@
       }
       set_mapview_scroll_pos(x, y);
       flush_dirty();
+      redraw_selection_rectangle();
     }
   } else {
     freelog(LOG_NORMAL, "action '%s' requested", action);
Index: client/mapctrl_common.c
===================================================================
--- client/mapctrl_common.c     (revision 11168)
+++ client/mapctrl_common.c     (working copy)
@@ -227,12 +227,23 @@
   }
 
   /* It is currently drawn only to the screen, not backing store */
+  rectangle_active = TRUE;
   draw_selection_rectangle(canvas_x, canvas_y, rec_w, rec_h);
   rec_corner_x = canvas_x;
   rec_corner_y = canvas_y;
 }
 
 /**************************************************************************
+  Redraws the selection rectangle after a map flush.
+**************************************************************************/
+void redraw_selection_rectangle(void)
+{
+  if (rectangle_active) {
+    draw_selection_rectangle(rec_corner_x, rec_corner_y, rec_w, rec_h);
+  }
+}
+
+/**************************************************************************
 ...
 **************************************************************************/
 bool is_city_hilited(struct city *pcity)
Index: client/mapctrl_common.h
===================================================================
--- client/mapctrl_common.h     (revision 11168)
+++ client/mapctrl_common.h     (working copy)
@@ -29,6 +29,7 @@
 
 void anchor_selection_rectangle(int canvas_x, int canvas_y);
 void update_selection_rectangle(int canvas_x, int canvas_y);
+void redraw_selection_rectangle(void);
 
 bool is_city_hilited(struct city *pcity);
 
Index: client/mapview_common.c
===================================================================
--- client/mapview_common.c     (revision 11168)
+++ client/mapview_common.c     (working copy)
@@ -584,6 +584,7 @@
       base_set_mapview_origin(start_x + diff_x * (mytime / timing_sec),
                              start_y + diff_y * (mytime / timing_sec));
       flush_dirty();
+      redraw_selection_rectangle();
       gui_flush();
       frames++;
     } while (currtime < timing_sec);
@@ -1044,6 +1045,7 @@
   dirty_rect(canvas_x, canvas_y, width, height);
 
   flush_dirty();
+  redraw_selection_rectangle();
   gui_flush();
 
   myusleep(1000000);
@@ -1706,6 +1708,7 @@
       dirty_rect(canvas_x, canvas_y, tileset_tile_width(tileset), 
tileset_tile_height(tileset));
 
       flush_dirty();
+      redraw_selection_rectangle();
       gui_flush();
 
       usleep_since_timer_start(anim_timer, 20000);
@@ -1785,6 +1788,7 @@
 
       /* Flush. */
       flush_dirty();
+      redraw_selection_rectangle();
       gui_flush();
 
       /* Restore the backup.  It won't take effect until the next flush. */
@@ -2119,6 +2123,7 @@
 
   if (write_to_screen) {
     flush_dirty();
+    redraw_selection_rectangle();
     flush_dirty_overview();
   }
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#14416) selection rectangle update bugs, Jason Short <=