Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] flickering screen in 1.14 (PR#6524)
Home

[Freeciv-Dev] flickering screen in 1.14 (PR#6524)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] flickering screen in 1.14 (PR#6524)
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Oct 2003 07:28:43 -0700
Reply-to: rt@xxxxxxxxxxxxxx

In 1.14, centering the canvas on the current position causes a full 
update which may result in flicker.  I'm not sure if this is worth 
fixing, but if so it should be done like this.

Does this fix your problem, Chris?

jason

? diff
? client/gui-sdl/.deps
? client/gui-sdl/Makefile
? client/gui-sdl/Makefile.in
? common/aicore/.deps
? common/aicore/Makefile
? common/aicore/Makefile.in
? data/nation/Makefile.am
? server/userdb/.deps
? server/userdb/Makefile
? server/userdb/Makefile.in
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.256.2.7
diff -u -r1.256.2.7 packhand.c
--- client/packhand.c   2003/03/17 16:20:54     1.256.2.7
+++ client/packhand.c   2003/10/22 14:25:51
@@ -274,6 +274,8 @@
 **************************************************************************/
 void handle_game_state(struct packet_generic_integer *packet)
 {
+  bool changed = (get_client_state() != packet->value);
+
   if(get_client_state()==CLIENT_SELECT_RACE_STATE && 
      packet->value==CLIENT_GAME_RUNNING_STATE &&
      game.player_ptr->nation == MAX_NUM_NATIONS) {
@@ -296,6 +298,10 @@
     
     free_intro_radar_sprites();
     agents_game_start();
+
+    if (changed) {
+      update_map_canvas_visible();
+    }
   }
 }
 
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.127.2.1
diff -u -r1.127.2.1 mapview.c
--- client/gui-gtk/mapview.c    2003/05/14 01:00:30     1.127.2.1
+++ client/gui-gtk/mapview.c    2003/10/22 14:25:51
@@ -720,15 +720,23 @@
 **************************************************************************/
 void center_tile_mapcanvas(int x, int y)
 {
-  base_center_tile_mapcanvas(x, y, &map_view_x0, &map_view_y0,
+  int new_x0, new_y0;
+
+  base_center_tile_mapcanvas(x, y, &new_x0, &new_y0,
                             map_canvas_store_twidth,
                             map_canvas_store_theight);
+
+  if (new_x0 != map_view_x0 || new_y0 != map_view_y0) {
+    map_view_x0 = new_x0;
+    map_view_y0 = new_y0;
 
-  update_map_canvas_visible();
-  update_map_canvas_scrollbars();
-  refresh_overview_viewrect();
-  if (hover_state == HOVER_GOTO || hover_state == HOVER_PATROL)
-    create_line_at_mouse_pos();
+    update_map_canvas_visible();
+    update_map_canvas_scrollbars();
+    refresh_overview_viewrect();
+    if (hover_state == HOVER_GOTO || hover_state == HOVER_PATROL) {
+      create_line_at_mouse_pos();
+    }
+  }
 }
 
 /**************************************************************************
Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.11.2.8
diff -u -r1.11.2.8 mapview.c
--- client/gui-gtk-2.0/mapview.c        2003/07/08 00:22:04     1.11.2.8
+++ client/gui-gtk-2.0/mapview.c        2003/10/22 14:25:51
@@ -725,15 +725,23 @@
 **************************************************************************/
 void center_tile_mapcanvas(int x, int y)
 {
-  base_center_tile_mapcanvas(x, y, &map_view_x0, &map_view_y0,
+  int new_x0, new_y0;
+
+  base_center_tile_mapcanvas(x, y, &new_x0, &new_y0,
                             map_canvas_store_twidth,
                             map_canvas_store_theight);
+
+  if (new_x0 != map_view_x0 || new_y0 != map_view_y0) {
+    map_view_x0 = new_x0;
+    map_view_y0 = new_y0;
 
-  update_map_canvas_visible();
-  update_map_canvas_scrollbars();
-  refresh_overview_viewrect();
-  if (hover_state == HOVER_GOTO || hover_state == HOVER_PATROL)
-    create_line_at_mouse_pos();
+    update_map_canvas_visible();
+    update_map_canvas_scrollbars();
+    refresh_overview_viewrect();
+    if (hover_state == HOVER_GOTO || hover_state == HOVER_PATROL) {
+      create_line_at_mouse_pos();
+    }
+  }
 }
 
 /**************************************************************************
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.29
diff -u -r1.29 mapview.c
--- client/gui-win32/mapview.c  2002/08/24 14:37:47     1.29
+++ client/gui-win32/mapview.c  2003/10/22 14:25:51
@@ -691,13 +691,20 @@
 **************************************************************************/
 void center_tile_mapcanvas(int x, int y)
 {
-  base_center_tile_mapcanvas(x, y, &map_view_x, &map_view_y,
+  int new_x0, new_y0;
+
+  base_center_tile_mapcanvas(x, y, &new_x0, &new_y0,
                             map_view_width, map_view_height);
+
+  if (new_x0 != map_view_x || new_y0 != map_view_y) {
+    map_view_x = new_x0;
+    map_view_y = new_y0;
 
-  update_map_canvas_visible();
-  update_map_canvas_scrollbars();
+    update_map_canvas_visible();
+    update_map_canvas_scrollbars();
 
-  refresh_overview_viewrect_real(NULL);
+    refresh_overview_viewrect_real(NULL);
+  }
 }
 
 /**************************************************************************
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.99.2.1
diff -u -r1.99.2.1 mapview.c
--- client/gui-xaw/mapview.c    2003/05/14 01:00:31     1.99.2.1
+++ client/gui-xaw/mapview.c    2003/10/22 14:25:51
@@ -463,14 +463,24 @@
 **************************************************************************/
 void center_tile_mapcanvas(int x, int y)
 {
-  base_center_tile_mapcanvas(x, y, &map_view_x0, &map_view_y0, 
map_canvas_store_twidth, map_canvas_store_theight);
+  int new_x0, new_y0;
 
-  update_map_canvas_visible();
-  update_map_canvas_scrollbars();
+  base_center_tile_mapcanvas(x, y, &new_x0, &new_y0,
+                            map_canvas_store_twidth,
+                            map_canvas_store_theight);
+
+  if (new_x0 != map_view_x0 || new_y0 != map_view_y0) {
+    map_view_x0 = new_x0;
+    map_view_y0 = new_y0;
+
+    update_map_canvas_visible();
+    update_map_canvas_scrollbars();
   
-  refresh_overview_viewrect();
-  if (hover_state == HOVER_GOTO || hover_state == HOVER_PATROL)
-    create_line_at_mouse_pos();
+    refresh_overview_viewrect();
+    if (hover_state == HOVER_GOTO || hover_state == HOVER_PATROL) {
+      create_line_at_mouse_pos();
+    }
+  }
 }
 
 /**************************************************************************

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