← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/remove_update into lp:widelands

 

SirVer has proposed merging lp:~widelands-dev/widelands/remove_update into lp:widelands.

Commit message:
Removed graphic::update() and Panel::update() and always redraw at maxfps. 


Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1395630 in widelands: "Remove maxfps, graphic update and all update methods in the UI classes and just redraw the screen at 60 fps"
  https://bugs.launchpad.net/widelands/+bug/1395630

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/remove_update/+merge/284524

The UI kept track of changes that happened - if you did not move the mouse in a menu, it would not redraw the screen. That was nice, because it meant that Widelands would not eat any CPU in a menu. Ingame we always redraw at maxfps anyways, so this request does not change anything there. 

Keeping track of the dirty state has a lot of complexity though - each widget has to remember to call update() when it needs to be redrawn. Even worse, in-game, each widget needs to get reminded to update if some external state changes. That is easy to get wrong. 

This change makes Widelands use more CPU in menus when you do not interact with the game (13% CPU vs 3% before on my system, but if you move the mouse it is equal), but it makes the code easier to reason about and less prone to bugs. A lot of the widgets could now be written much simpler - since they do not need to try to cache state (for example WaresQueueDisplay). It seems to me that it should go in, but I am not sure.

 
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/remove_update into lp:widelands.
=== modified file 'src/editor/ui_menus/editor_tool_menu.cc'
--- src/editor/ui_menus/editor_tool_menu.cc	2016-01-18 19:35:25 +0000
+++ src/editor/ui_menus/editor_tool_menu.cc	2016-01-30 22:45:22 +0000
@@ -152,7 +152,6 @@
 		parent.mutable_field_overlay_manager()->register_overlay_callback_function(
 		   boost::bind(&editor_Tool_set_port_space_callback, _1, boost::ref(map)));
 		map.recalc_whole_map(parent.egbase().world());
-		update();
 	}
 
 	if (current_registry_pointer) {

=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc	2016-01-28 07:00:21 +0000
+++ src/graphic/graphic.cc	2016-01-30 22:45:22 +0000
@@ -76,7 +76,6 @@
                          bool init_fullscreen) {
 	window_mode_width_ = window_mode_w;
 	window_mode_height_ = window_mode_h;
-	requires_update_ = true;
 
 	if (SDL_GL_LoadLibrary(nullptr) == -1) {
 		throw wexception("SDL_GL_LoadLibrary failed: %s", SDL_GetError());
@@ -169,8 +168,6 @@
 	render_target_.reset(new RenderTarget(screen_.get()));
 
 	Notifications::publish(GraphicResolutionChanged{new_w, new_h});
-
-	update();
 }
 
 /**
@@ -214,18 +211,6 @@
 	resolution_changed();
 }
 
-
-void Graphic::update() {
-	requires_update_ = true;
-}
-
-/**
- * Returns true if parts of the screen have been marked for refreshing.
-*/
-bool Graphic::need_update() const {
-	return requires_update_;
-}
-
 /**
  * Bring the screen uptodate.
 */
@@ -255,7 +240,6 @@
 	}
 
 	SDL_GL_SwapWindow(sdl_window_);
-	requires_update_ = false;
 }
 
 /**
@@ -264,7 +248,4 @@
 void Graphic::screenshot(const string& fname)
 {
 	screenshot_filename_ = fname;
-
-	// Force a redraw of the screen soon.
-	update();
 }

=== modified file 'src/graphic/graphic.h'
--- src/graphic/graphic.h	2016-01-24 12:43:26 +0000
+++ src/graphic/graphic.h	2016-01-30 22:45:22 +0000
@@ -71,8 +71,6 @@
 	void set_fullscreen(bool);
 
 	RenderTarget * get_render_target();
-	void update();
-	bool need_update() const;
 	void refresh();
 	SDL_Window* get_sdlwindow() {return sdl_window_;}
 
@@ -103,9 +101,6 @@
 	/// A RenderTarget for screen_. This is initialized during init()
 	std::unique_ptr<RenderTarget> render_target_;
 
-	/// This marks the complete screen for updating.
-	bool requires_update_;
-
 	/// Non-volatile cache of independent images.
 	std::unique_ptr<ImageCache> image_cache_;
 

=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc	2016-01-24 07:45:11 +0000
+++ src/logic/map_objects/tribes/production_program.cc	2016-01-30 22:45:22 +0000
@@ -121,7 +121,7 @@
 		} else if (*p != *pattern)
 			return false;
 
-	return false;
+	NEVER_HERE();
 }
 
 ProductionProgram::ActReturn::Condition * create_economy_condition

=== modified file 'src/ui_basic/button.cc'
--- src/ui_basic/button.cc	2015-11-28 14:19:26 +0000
+++ src/ui_basic/button.cc	2016-01-30 22:45:22 +0000
@@ -107,8 +107,6 @@
 		return;
 
 	m_pic_custom = pic;
-
-	update();
 }
 
 
@@ -121,8 +119,6 @@
 
 	m_pic_custom = nullptr;
 	m_title      = title;
-
-	update();
 }
 
 
@@ -147,7 +143,6 @@
 		m_enabled = false;
 		m_highlighted = false;
 	}
-	update();
 }
 
 
@@ -319,8 +314,6 @@
 		sigmousein();
 	else
 		sigmouseout();
-
-	update();
 }
 
 
@@ -340,10 +333,9 @@
 			set_thinks(true);
 		}
 	}
-	update();
-
 	return true;
 }
+
 bool Button::handle_mouserelease(uint8_t const btn, int32_t, int32_t) {
 	if (btn != SDL_BUTTON_LEFT)
 		return false;
@@ -352,7 +344,6 @@
 		m_pressed = false;
 		set_thinks(false);
 		grab_mouse(false);
-		update();
 		if (m_highlighted && m_enabled) {
 			play_click();
 			sigclicked();
@@ -372,7 +363,6 @@
 void Button::set_perm_pressed(bool state) {
 	if (state != m_permpressed) {
 		m_permpressed = state;
-		update();
 	}
 }
 

=== modified file 'src/ui_basic/checkbox.cc'
--- src/ui_basic/checkbox.cc	2015-12-17 09:36:59 +0000
+++ src/ui_basic/checkbox.cc	2016-01-30 22:45:22 +0000
@@ -98,8 +98,6 @@
 		set_flags
 			(Is_Highlighted, (m_flags & Is_Highlighted) && (m_flags & Is_Enabled));
 	}
-
-	update();
 }
 
 
@@ -113,7 +111,6 @@
 		set_flags(Is_Checked, on);
 		changed();
 		changedto(on);
-		update();
 	}
 }
 
@@ -170,11 +167,7 @@
  * Highlight the checkbox when the mouse moves into it
  */
 void Statebox::handle_mousein(bool const inside) {
-	bool oldhl = m_flags & Is_Highlighted;
 	set_flags(Is_Highlighted, inside && (m_flags & Is_Enabled));
-
-	if (oldhl != (m_flags & Is_Highlighted))
-		update();
 }
 
 

=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc	2015-12-17 09:36:59 +0000
+++ src/ui_basic/editbox.cc	2016-01-30 22:45:22 +0000
@@ -137,8 +137,6 @@
 		m->text.erase(m->text.begin() + m->maxLength, m->text.end());
 	if (caretatend || m->caret > m->text.size())
 		m->caret = m->text.size();
-
-	update();
 }
 
 
@@ -167,7 +165,6 @@
 			m->caret = m->text.size();
 
 		check_caret();
-		update();
 	}
 }
 
@@ -194,7 +191,6 @@
 		m->align = _align;
 		m->scrolloffset = 0;
 		check_caret();
-		update();
 	}
 }
 
@@ -206,7 +202,6 @@
 {
 	if (btn == SDL_BUTTON_LEFT && get_can_focus()) {
 		focus();
-		update();
 		return true;
 	}
 
@@ -268,7 +263,6 @@
 				m->text.erase(m->text.begin() + m->caret);
 				check_caret();
 				changed();
-				update();
 			}
 			return true;
 
@@ -286,8 +280,6 @@
 							break;
 
 				check_caret();
-
-				update();
 			}
 			return true;
 
@@ -311,7 +303,6 @@
 						}
 
 				check_caret();
-				update();
 			}
 			return true;
 
@@ -325,7 +316,6 @@
 				m->caret = 0;
 
 				check_caret();
-				update();
 			}
 			return true;
 
@@ -338,7 +328,6 @@
 			if (m->caret != m->text.size()) {
 				m->caret = m->text.size();
 				check_caret();
-				update();
 			}
 			return true;
 
@@ -356,7 +345,6 @@
 					m->text = m_history[m_history_position];
 					m->caret = m->text.size();
 					check_caret();
-					update();
 				}
 			}
 			return true;
@@ -375,7 +363,6 @@
 					m->text = m_history[m_history_position];
 					m->caret = m->text.size();
 					check_caret();
-					update();
 				}
 			}
 			return true;
@@ -394,7 +381,6 @@
 		m->caret += input_text.length();
 		check_caret();
 		changed();
-		update();
 	}
 	return true;
 }

=== modified file 'src/ui_basic/icon.cc'
--- src/ui_basic/icon.cc	2014-12-04 09:00:20 +0000
+++ src/ui_basic/icon.cc	2016-01-30 22:45:22 +0000
@@ -38,7 +38,6 @@
 
 void Icon::set_icon(const Image* picture_id) {
 	m_pic = picture_id;
-	update();
 }
 
 void Icon::set_frame(const RGBColor& color)

=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc	2016-01-28 21:27:04 +0000
+++ src/ui_basic/listselect.cc	2016-01-30 22:45:22 +0000
@@ -152,8 +152,6 @@
 
 	m_scrollbar.set_steps(m_entry_records.size() * get_lineheight() - get_h());
 
-	update(0, 0, get_w(), get_h());
-
 	if (sel)
 		select(m_entry_records.size() - 1);
 }
@@ -194,8 +192,6 @@
 
 	m_scrollbar.set_steps(m_entry_records.size() * get_lineheight() - get_h());
 
-	update(0, 0, get_w(), get_h());
-
 	if (sel)
 		select(0);
 }
@@ -254,8 +250,6 @@
 		return;
 
 	m_scrollpos = i;
-
-	update(0, 0, get_w(), get_h());
 }
 
 
@@ -291,7 +285,6 @@
 	m_selection = i;
 
 	selected(m_selection);
-	update(0, 0, get_w(), get_h());
 }
 
 /**

=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc	2016-01-28 21:27:04 +0000
+++ src/ui_basic/multilineeditbox.cc	2016-01-30 22:45:22 +0000
@@ -122,7 +122,6 @@
 void MultilineEditbox::Data::update()
 {
 	ww_valid = false;
-	owner.update();
 }
 
 /**
@@ -443,7 +442,6 @@
  */
 void MultilineEditbox::focus(bool topcaller) {
 	Panel::focus(topcaller);
-	update();
 }
 
 /**
@@ -499,8 +497,6 @@
 void MultilineEditbox::Data::insert(uint32_t where, const std::string & s)
 {
 	text.insert(where, s);
-	update();
-
 	if (cursor_pos >= where)
 		set_cursor_pos(cursor_pos + s.size());
 }
@@ -517,7 +513,6 @@
 		return;
 
 	cursor_pos = newpos;
-	owner.update();
 
 	scroll_cursor_into_view();
 }
@@ -538,10 +533,8 @@
 
 	if (top < int32_t(scrollbar.get_scrollpos())) {
 		scrollbar.set_scrollpos(top - lineheight);
-		owner.update();
 	} else if (top + lineheight > int32_t(scrollbar.get_scrollpos()) + owner.get_h()) {
 		scrollbar.set_scrollpos(top - owner.get_h() + 2 * lineheight);
-		owner.update();
 	}
 }
 
@@ -550,7 +543,6 @@
  */
 void MultilineEditbox::scrollpos_changed(int32_t)
 {
-	update();
 }
 
 /**

=== modified file 'src/ui_basic/multilinetextarea.cc'
--- src/ui_basic/multilinetextarea.cc	2016-01-28 21:27:04 +0000
+++ src/ui_basic/multilinetextarea.cc	2016-01-30 22:45:22 +0000
@@ -59,8 +59,6 @@
 	m_scrollbar.set_force_draw(always_show_scrollbar);
 
 	recompute();
-
-	update(0, 0, get_eff_w(), get_h());
 }
 
 
@@ -112,8 +110,6 @@
 			break; // No need to wrap twice.
 		}
 	}
-
-	update(0, 0, get_eff_w(), get_h());
 }
 
 /**
@@ -121,7 +117,6 @@
  */
 void MultilineTextarea::scrollpos_changed(int32_t const /* pixels */)
 {
-	update(0, 0, get_eff_w(), get_h());
 }
 
 /**
@@ -190,7 +185,6 @@
 
 void MultilineTextarea::scroll_to_top() {
 	m_scrollbar.set_scrollpos(0);
-	update(0, 0, 0, 0);
 }
 
 } // namespace UI

=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc	2016-01-27 08:06:40 +0000
+++ src/ui_basic/panel.cc	2016-01-30 22:45:22 +0000
@@ -73,7 +73,6 @@
 		_parent->_fchild = this;
 	} else
 		_prev = _next = nullptr;
-	update(0, 0, _w, _h);
 }
 
 /**
@@ -81,8 +80,6 @@
  */
 Panel::~Panel()
 {
-	update();
-
 	// Release pointers to this object
 	if (_g_mousegrab == this)
 		_g_mousegrab = nullptr;
@@ -150,15 +147,9 @@
 
 	// Panel-specific startup code. This might call end_modal()!
 	start();
-	g_gr->update();
 
-	uint32_t minTime;
-	{
-		int maxfps = g_options.pull_section("global").get_int("maxfps", 25);
-		if (maxfps < 5)
-			maxfps = 5;
-		minTime = 1000 / maxfps;
-	}
+	const uint32_t minimum_frame_time =
+	   1000 / std::max(5, g_options.pull_section("global").get_int("maxfps", 30));
 
 	while (_running) {
 		const uint32_t startTime = SDL_GetTicks();
@@ -178,32 +169,22 @@
 
 		do_think();
 
-		if (g_gr->need_update()) {
-			RenderTarget & rt = *g_gr->get_render_target();
-
-			forefather->do_draw(rt);
-
-			rt.blit
-				(app->get_mouse_position() - Point(3, 7),
-				 WLApplication::get()->is_mouse_pressed() ?
-					s_default_cursor_click :
-					s_default_cursor);
-
-			forefather->do_tooltip();
-
-			g_gr->refresh();
-		}
+		RenderTarget& rt = *g_gr->get_render_target();
+		forefather->do_draw(rt);
+		rt.blit(app->get_mouse_position() - Point(3, 7),
+		        WLApplication::get()->is_mouse_pressed() ? s_default_cursor_click : s_default_cursor);
+		forefather->do_tooltip();
+		g_gr->refresh();
 
 		if (_flags & pf_child_die)
 			check_child_death();
 
 		//  Wait until 1second/maxfps are over.
-		const uint32_t diffTime = SDL_GetTicks() - startTime;
-		if (diffTime < minTime) {
-			SDL_Delay(minTime - diffTime);
+		const uint32_t frame_time = SDL_GetTicks() - startTime;
+		if (frame_time < minimum_frame_time) {
+			SDL_Delay(minimum_frame_time - frame_time);
 		}
 	}
-	g_gr->update();
 	end();
 
 	// Done
@@ -242,8 +223,6 @@
 	if (nw == _w && nh == _h)
 		return;
 
-	int const upw = std::min(nw, _w);
-	int const uph = std::min(nh, _h);
 	_w = nw;
 	_h = nh;
 
@@ -251,18 +230,14 @@
 		move_inside_parent();
 
 	layout();
-
-	update(0, 0, upw, uph);
 }
 
 /**
  * Move the panel. Panel's position is relative to the parent.
  */
 void Panel::set_pos(const Point n) {
-	update(0, 0, _w, _h);
 	_x = n.x;
 	_y = n.y;
-	update(0, 0, _w, _h);
 }
 
 /**
@@ -383,7 +358,6 @@
 	_rborder = r;
 	_tborder = t;
 	_bborder = b;
-	update();
 }
 
 /**
@@ -425,8 +399,6 @@
 	_flags &= ~pf_visible;
 	if (on)
 		_flags |= pf_visible;
-
-	update(0, 0, _w, _h);
 }
 
 /**
@@ -447,63 +419,6 @@
 */
 void Panel::draw_overlay(RenderTarget &) {}
 
-
-/**
- * Mark a part of a panel for updating.
- */
-void Panel::update(int x, int y, int w, int h)
-{
-	if
-		(x >= _w || x + w <= 0
-		 ||
-		 y >= _h || y + h <= 0)
-		return;
-
-	if (_parent) {
-		_parent->update_inner(x + _x, y + _y, w, h);
-	} else {
-		if (x < 0) {
-			w += x;
-			x = 0;
-		}
-		if (x + w > g_gr->get_xres())
-			w = g_gr->get_xres() - x;
-		if (w <= 0)
-			return;
-
-		if (y < 0) {
-			h += y;
-			y = 0;
-		}
-		if (y + h > g_gr->get_yres())
-			h = g_gr->get_yres() - y;
-		if (h <= 0)
-			return;
-
-		g_gr->update();
-	}
-}
-
-
-/**
- * Overload for convenience.
- *
- * Equivalent to update(0, 0, get_w(), get_h());
- */
-void Panel::update()
-{
-	update(0, 0, get_w(), get_h());
-}
-
-
-/**
- * Mark a part of a panel for updating.
- */
-void Panel::update_inner(int32_t x, int32_t y, int32_t w, int32_t h)
-{
-	update(x - _lborder, y - _tborder, w, h);
-}
-
 /**
  * Called once per event loop pass, unless set_think(false) has
  * been called. It is intended to be used for animations and game logic.
@@ -627,7 +542,6 @@
 					while (p != _focus) {
 						if (p->get_can_focus()) {
 							p->focus();
-							p->update();
 							break;
 						}
 						if (p == _lchild) {
@@ -1110,11 +1024,8 @@
 		return true;
 	}
 
-	Panel * p;
-	g_gr->update();
-
-	p = ui_trackmouse(x, y);
-	if (!p)
+	Panel* const p = ui_trackmouse(x, y);
+	if (p == nullptr)
 		return false;
 
 	return p->do_mousemove(state, x, y, xdiff, ydiff);

=== modified file 'src/ui_basic/panel.h'
--- src/ui_basic/panel.h	2016-01-27 08:06:40 +0000
+++ src/ui_basic/panel.h	2016-01-30 22:45:22 +0000
@@ -186,9 +186,6 @@
 	virtual void draw        (RenderTarget &);
 	virtual void draw_border (RenderTarget &);
 	virtual void draw_overlay(RenderTarget &);
-	void update(int32_t x, int32_t y, int32_t w, int32_t h);
-	void update();
-	void update_inner(int32_t x, int32_t y, int32_t w, int32_t h);
 
 	// Events
 	virtual void think();

=== modified file 'src/ui_basic/progressbar.cc'
--- src/ui_basic/progressbar.cc	2015-12-17 09:36:59 +0000
+++ src/ui_basic/progressbar.cc	2016-01-30 22:45:22 +0000
@@ -49,8 +49,6 @@
 void ProgressBar::set_state(uint32_t state)
 {
 	m_state = state;
-
-	update();
 }
 
 
@@ -61,8 +59,6 @@
 {
 	assert(total);
 	m_total = total;
-
-	update();
 }
 
 

=== modified file 'src/ui_basic/progresswindow.cc'
--- src/ui_basic/progresswindow.cc	2015-12-17 09:36:59 +0000
+++ src/ui_basic/progresswindow.cc	2016-01-30 22:45:22 +0000
@@ -89,7 +89,6 @@
 		m_background = "pics/progress.png";
 	}
 	draw_background(rt, g_gr->get_xres(), g_gr->get_yres());
-	update(true);
 }
 
 void ProgressWindow::step(const std::string & description) {
@@ -106,13 +105,11 @@
 			 UI::g_fh1->render(as_uifont(description, UI_FONT_SIZE_SMALL, PROGRESS_FONT_COLOR_FG)),
 			 BlendMode::UseAlpha,
 			 UI::Align::kCenter);
-	g_gr->update();
 
 #ifdef _WIN32
 		// Pump events to prevent "not responding" on windows
 		SDL_PumpEvents();
 #endif
-
 	update(true);
 }
 
@@ -121,6 +118,7 @@
 		visualization->update(repaint); //  let visualizations do their work
 	}
 	g_gr->refresh();
+
 }
 
 /**

=== modified file 'src/ui_basic/scrollbar.cc'
--- src/ui_basic/scrollbar.cc	2016-01-17 20:04:07 +0000
+++ src/ui_basic/scrollbar.cc	2016-01-30 22:45:22 +0000
@@ -79,7 +79,6 @@
 		set_scrollpos(steps - 1);
 
 	m_steps = steps;
-	update();
 }
 
 
@@ -136,8 +135,6 @@
 
 	m_pos = pos;
 	moved(pos);
-
-	update();
 }
 
 
@@ -428,7 +425,6 @@
 	default:
 		break;
 	}
-	update();
 	return result;
 }
 bool Scrollbar::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
@@ -446,7 +442,6 @@
 	default:
 		break;
 	}
-	update();
 	return result;
 }
 

=== modified file 'src/ui_basic/slider.cc'
--- src/ui_basic/slider.cc	2015-12-17 09:36:59 +0000
+++ src/ui_basic/slider.cc	2016-01-30 22:45:22 +0000
@@ -82,7 +82,6 @@
 		m_value = new_value;
 		calculate_cursor_position();
 		send_value_changed();
-		update();
 	}
 }
 
@@ -115,7 +114,6 @@
 	assert(m_min_value <= new_max);
 	if (m_max_value != new_max) {
 		calculate_cursor_position();
-		update();
 	}
 	m_max_value = new_max;
 	set_value(m_value);
@@ -130,7 +128,6 @@
 	assert(m_max_value >= new_min);
 	if (m_min_value != new_min) {
 		calculate_cursor_position();
-		update();
 	}
 	m_min_value = new_min;
 	set_value(m_value);
@@ -216,13 +213,11 @@
 		m_highlighted = false;
 		grab_mouse(false);
 	}
-	update();
 }
 
 
 /**
- * Set whether the sliding button should be highlighted,
- * and trigger a draw update when necessary.
+ * Set whether the sliding button should be highlighted.
  */
 void Slider::set_highlighted(bool highlighted)
 {
@@ -230,7 +225,6 @@
 		return;
 
 	m_highlighted = highlighted;
-	update();
 }
 
 
@@ -260,8 +254,6 @@
 
 		//  cursor position: align to integer value
 		calculate_cursor_position();
-
-		update();
 	}
 	return true;
 }
@@ -275,8 +267,6 @@
  * \param y The y position of the mouse pointer.
  */
 void Slider::cursor_moved(int32_t pointer, int32_t x, int32_t y) {
-	int32_t o_cursor_pos = m_cursor_pos;
-
 	if (!m_enabled)
 		return;
 
@@ -313,9 +303,6 @@
 		m_value = new_value;
 		send_value_changed();
 	}
-
-	if (o_cursor_pos != m_cursor_pos)
-		update();
 }
 
 
@@ -334,8 +321,6 @@
 	m_relative_move = pointer - m_cursor_pos;
 
 	play_click();
-
-	update();
 }
 
 
@@ -376,7 +361,6 @@
 	send_value_changed();
 
 	m_relative_move = ofs;
-	update();
 }
 
 void VerticalSlider::layout() {

=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc	2016-01-28 21:27:04 +0000
+++ src/ui_basic/table.cc	2016-01-30 22:45:22 +0000
@@ -448,7 +448,6 @@
 					if (column.is_checkbox_column) {
 						play_click();
 						m_entry_records.at(row)->toggle(col);
-						update(0, 0, get_eff_w(), get_h());
 					}
 					break;
 				}
@@ -524,7 +523,6 @@
 	m_selection = i;
 
 	selected(m_selection);
-	update(0, 0, get_eff_w(), get_h());
 }
 
 /**
@@ -551,8 +549,6 @@
 		select(m_entry_records.size() - 1);
 		m_scrollbar->set_scrollpos(std::numeric_limits<int32_t>::max());
 	}
-
-	update(0, 0, get_eff_w(), get_h());
 	return result;
 }
 
@@ -562,8 +558,6 @@
 void Table<void *>::set_scrollpos(int32_t const i)
 {
 	m_scrollpos = i;
-
-	update(0, 0, get_eff_w(), get_h());
 }
 
 /**
@@ -631,8 +625,6 @@
 			newselection = i;
 	}
 	m_selection = newselection;
-
-	update();
 }
 
 /**

=== modified file 'src/ui_basic/tabpanel.cc'
--- src/ui_basic/tabpanel.cc	2016-01-28 21:27:04 +0000
+++ src/ui_basic/tabpanel.cc	2016-01-30 22:45:22 +0000
@@ -385,7 +385,6 @@
 void TabPanel::handle_mousein(bool inside)
 {
 	if (!inside && highlight_ != kNotFound) {
-		update(tabs_[highlight_]->get_x(), 0, tabs_[highlight_]->get_w(), kTabPanelButtonHeight);
 		highlight_ = kNotFound;
 	}
 }
@@ -400,12 +399,6 @@
 	size_t hl = find_tab(x, y);
 
 	if (hl != highlight_) {
-		if (hl != kNotFound) {
-			update(tabs_[hl]->get_x(), 0, tabs_[hl]->get_w(), kTabPanelButtonHeight);
-		}
-		if (highlight_ != kNotFound) {
-			update(tabs_[highlight_]->get_x(), 0, tabs_[highlight_]->get_w(), kTabPanelButtonHeight);
-		}
 		highlight_ = hl;
 		set_tooltip(highlight_ != kNotFound ? tabs_[highlight_]->tooltip : "");
 	}

=== modified file 'src/ui_basic/textarea.cc'
--- src/ui_basic/textarea.cc	2016-01-28 21:27:04 +0000
+++ src/ui_basic/textarea.cc	2016-01-30 22:45:22 +0000
@@ -137,8 +137,6 @@
 		expand();
 	else if (m_layoutmode == Layouted)
 		update_desired_size();
-
-	update();
 }
 
 const std::string& Textarea::get_text()

=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc	2016-01-28 21:27:04 +0000
+++ src/ui_basic/window.cc	2016-01-30 22:45:22 +0000
@@ -110,7 +110,6 @@
 void Window::set_title(const string & text)
 {
 	m_title = is_richtext(text) ? text : as_window_title(text);
-	update(0, 0, get_w(), TP_B_PIXMAP_THICKNESS);
 }
 
 /**

=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc	2016-01-28 21:27:04 +0000
+++ src/wui/game_message_menu.cc	2016-01-30 22:45:22 +0000
@@ -339,9 +339,6 @@
 	if (list->size()) {
 		if (!list->has_selection())
 			list->select(0);
-			// TODO(unknown): Workaround for bug #691928: There should
-			// be a solution without this extra update().
-			list->update();
 	} else {
 		centerviewbtn_->set_enabled(false);
 		message_body.set_text(std::string());

=== modified file 'src/wui/game_summary.cc'
--- src/wui/game_summary.cc	2016-01-28 21:27:04 +0000
+++ src/wui/game_summary.cc	2016-01-30 22:45:22 +0000
@@ -218,7 +218,6 @@
 				  % static_cast<unsigned int>(teawon_)).str());
 		}
 	}
-	players_table_->update();
 	if (!players_status.empty()) {
 		players_table_->select(current_player_position);
 	}

=== modified file 'src/wui/game_tips.cc'
--- src/wui/game_tips.cc	2016-01-24 20:11:53 +0000
+++ src/wui/game_tips.cc	2016-01-30 22:45:22 +0000
@@ -119,6 +119,4 @@
 	Point center(tips_area.x + tips_area.w / 2, tips_area.y + tips_area.h / 2);
 	const Image* rendered_text = UI::g_fh1->render(as_game_tip(tips_[index].text), tips_area.w);
 	rt.blit(center - Point(rendered_text->width() / 2, rendered_text->height() / 2), rendered_text);
-
-	g_gr->update();
 }

=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc	2016-01-28 21:27:04 +0000
+++ src/wui/interactive_base.cc	2016-01-30 22:45:22 +0000
@@ -335,13 +335,8 @@
 			set_rel_viewpoint(Point (scrollval, 0), false);
 		}
 	}
-
 	egbase().think(); // Call game logic here. The game advances.
 
-	//  The entire screen needs to be redrawn (unit movement, tile animation,
-	//  etc...)
-	g_gr->update();
-
 	UI::Panel::think();
 }
 

=== modified file 'src/wui/itemwaresdisplay.cc'
--- src/wui/itemwaresdisplay.cc	2016-01-24 20:11:53 +0000
+++ src/wui/itemwaresdisplay.cc	2016-01-30 22:45:22 +0000
@@ -52,10 +52,7 @@
  */
 void ItemWaresDisplay::clear()
 {
-	if (!items_.empty()) {
-		items_.clear();
-		update();
-	}
+	items_.clear();
 }
 
 /**
@@ -100,7 +97,6 @@
 	it.worker = worker;
 	it.index = index;
 	items_.push_back(it);
-	update();
 }
 
 void ItemWaresDisplay::draw(RenderTarget & dst)

=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc	2016-01-24 20:11:53 +0000
+++ src/wui/mapview.cc	2016-01-30 22:45:22 +0000
@@ -168,8 +168,6 @@
 
 	if (!intbase().get_sel_freeze())
 		track_sel(Point(x, y));
-
-	g_gr->update();
 	return true;
 }
 

=== modified file 'src/wui/minimap.cc'
--- src/wui/minimap.cc	2016-01-24 20:11:53 +0000
+++ src/wui/minimap.cc	2016-01-30 22:45:22 +0000
@@ -54,8 +54,6 @@
 {
 	viewx_ = x / TRIANGLE_WIDTH;
 	viewy_ = y / TRIANGLE_HEIGHT;
-
-	update();
 }
 
 

=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc	2016-01-28 21:27:04 +0000
+++ src/wui/productionsitewindow.cc	2016-01-30 22:45:22 +0000
@@ -202,7 +202,6 @@
 			continue;
 		}
 	}
-	worker_table_->update();
 }
 
 void ProductionSiteWindow::evict_worker() {

=== modified file 'src/wui/soldierlist.cc'
--- src/wui/soldierlist.cc	2016-01-28 21:27:04 +0000
+++ src/wui/soldierlist.cc	2016-01-30 22:45:22 +0000
@@ -271,7 +271,6 @@
 	if (changes) {
 		Point mousepos = get_mouse_position();
 		m_mouseover_fn(find_soldier(mousepos.x, mousepos.y));
-		update();
 	}
 }
 

=== modified file 'src/wui/waresdisplay.cc'
--- src/wui/waresdisplay.cc	2016-01-28 21:27:04 +0000
+++ src/wui/waresdisplay.cc	2016-01-30 22:45:22 +0000
@@ -260,7 +260,6 @@
 			}
 		}
 	}
-	update();
 }
 
 
@@ -273,10 +272,6 @@
 
 void WaresDisplay::remove_all_warelists() {
 	warelists_.clear();
-	for (boost::signals2::connection& c : connections_)
-		c.disconnect();
-	connections_.clear();
-	update();
 }
 
 
@@ -384,7 +379,6 @@
 		return;
 
 	selected_[ware] = true;
-	update();
 	if (callback_function_)
 			callback_function_(ware, true);
 }
@@ -395,7 +389,6 @@
 		return;
 
 	selected_[ware] = false;
-	update();
 	if (callback_function_)
 			callback_function_(ware, false);
 }
@@ -409,18 +402,14 @@
 {
 	if (hidden_[ware])
 		return;
-
 	hidden_[ware] = true;
-	update();
 }
 
 void AbstractWaresDisplay::unhide_ware(Widelands::DescriptionIndex ware)
 {
 	if (!hidden_[ware])
 		return;
-
 	hidden_[ware] = false;
-	update();
 }
 
 bool AbstractWaresDisplay::ware_hidden(Widelands::DescriptionIndex ware) {
@@ -463,9 +452,6 @@
 {
 	//  If you register something twice, it is counted twice. Not my problem.
 	warelists_.push_back(&wares);
-
-	connections_.push_back(wares.changed.connect(boost::bind(&WaresDisplay::update, boost::ref(*this))));
-	update();
 }
 
 

=== modified file 'src/wui/waresdisplay.h'
--- src/wui/waresdisplay.h	2016-01-24 20:11:53 +0000
+++ src/wui/waresdisplay.h	2016-01-30 22:45:22 +0000
@@ -22,8 +22,6 @@
 
 #include <vector>
 
-#include <boost/signals2.hpp>
-
 #include "logic/map_objects/tribes/tribe_descr.h"
 #include "logic/map_objects/tribes/warelist.h"
 #include "logic/map_objects/tribes/wareworker.h"
@@ -144,7 +142,6 @@
 private:
 	using WareListVector = std::vector<const Widelands::WareList *>;
 	WareListVector         warelists_;
-	std::vector<boost::signals2::connection> connections_;
 };
 
 std::string waremap_to_richtext

=== modified file 'src/wui/waresqueuedisplay.cc'
--- src/wui/waresqueuedisplay.cc	2016-01-24 20:11:53 +0000
+++ src/wui/waresqueuedisplay.cc	2016-01-30 22:45:22 +0000
@@ -52,7 +52,6 @@
 ware_type_(Widelands::wwWARE),
 max_fill_indicator_(g_gr->images().get(pic_max_fill_indicator)),
 cache_size_(queue->get_max_size()),
-cache_filled_(queue->get_filled()),
 cache_max_fill_(queue->get_max_fill()),
 total_height_(0),
 show_only_(show_only)
@@ -112,15 +111,11 @@
 	if (static_cast<uint32_t>(queue_->get_max_size()) != cache_size_)
 		max_size_changed();
 
-	if (static_cast<uint32_t>(queue_->get_filled()) != cache_filled_)
-		update();
-
+	// TODO(sirver): It seems cache_max_fill_ is not really useful for anything.
 	if (static_cast<uint32_t>(queue_->get_max_fill()) != cache_max_fill_) {
 		cache_max_fill_ = queue_->get_max_fill();
 		compute_max_fill_buttons_enabled_state();
-		update();
 	}
-
 }
 
 /**
@@ -131,10 +126,9 @@
 	if (!cache_size_)
 		return;
 
-	cache_filled_ = queue_->get_filled();
 	cache_max_fill_ = queue_->get_max_fill();
 
-	uint32_t nr_wares_to_draw = std::min(cache_filled_, cache_size_);
+	uint32_t nr_wares_to_draw = std::min(queue_->get_filled(), cache_size_);
 	uint32_t nr_empty_to_draw = cache_size_ - nr_wares_to_draw;
 
 	Point point;
@@ -258,7 +252,6 @@
 	increase_max_fill_->set_repeating(true);
 	decrease_max_fill_->set_repeating(true);
 	compute_max_fill_buttons_enabled_state();
-
 }
 
 /**

=== modified file 'src/wui/waresqueuedisplay.h'
--- src/wui/waresqueuedisplay.h	2016-01-24 20:11:53 +0000
+++ src/wui/waresqueuedisplay.h	2016-01-30 22:45:22 +0000
@@ -82,7 +82,6 @@
 
 
 	uint32_t         cache_size_;
-	uint32_t         cache_filled_;
 	uint32_t         cache_max_fill_;
 	uint32_t         total_height_;
 	bool             show_only_;


Follow ups