← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1289943 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1289943 into lp:widelands.

Commit message:
When a waresqueue disappears in a minimized constructionsite window, the contents no longer leak on screen.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1289943 in widelands: "minimized construction window contents get leaked out"
  https://bugs.launchpad.net/widelands/+bug/1289943

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1289943/+merge/285201

When a waresqueue disappears in a minimized constructionsite window, the contents no longer leak on screen.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1289943 into lp:widelands.
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc	2016-01-29 08:37:22 +0000
+++ src/wui/buildingwindow.cc	2016-02-05 15:56:21 +0000
@@ -528,7 +528,7 @@
 	 bool show_only)
 {
 	// The *max* width should be larger than the default width
-	box->add(new WaresQueueDisplay(box, 0, 0, igbase(), b, wq, show_only), UI::Align::kLeft);
+	box->add(new WaresQueueDisplay(box, 0, 0, igbase(), *this, b, wq, show_only), UI::Align::kLeft);
 }
 
 /**

=== modified file 'src/wui/constructionsitewindow.cc'
--- src/wui/constructionsitewindow.cc	2016-01-29 08:37:22 +0000
+++ src/wui/constructionsitewindow.cc	2016-02-05 15:56:21 +0000
@@ -68,7 +68,7 @@
 	// Add the wares queue
 	for (uint32_t i = 0; i < cs.get_nrwaresqueues(); ++i)
 		box.add
-			(new WaresQueueDisplay(&box, 0, 0, igbase(), cs, cs.get_waresqueue(i)),
+			(new WaresQueueDisplay(&box, 0, 0, igbase(), *registry, cs, cs.get_waresqueue(i)),
 			 UI::Align::kLeft);
 
 

=== modified file 'src/wui/portdockwaresdisplay.cc'
--- src/wui/portdockwaresdisplay.cc	2016-01-28 21:27:04 +0000
+++ src/wui/portdockwaresdisplay.cc	2016-02-05 15:56:21 +0000
@@ -71,13 +71,13 @@
 }
 
 /// Create a panel that displays the wares and the builder waiting for the expedition to start.
-UI::Box * create_portdock_expedition_display(UI::Panel * parent, Warehouse & wh, InteractiveGameBase & igb)
+UI::Box * create_portdock_expedition_display(UI::Panel * parent, Warehouse & wh, InteractiveGameBase & igb, UI::Window*& registry)
 {
 	UI::Box & box = *new UI::Box(parent, 0, 0, UI::Box::Vertical);
 
 	// Add the wares queues.
 	for (WaresQueue* wq : wh.get_portdock()->expedition_bootstrap()->wares()) {
-		box.add(new WaresQueueDisplay(&box, 0, 0, igb, wh, wq, true), UI::Align::kLeft);
+		box.add(new WaresQueueDisplay(&box, 0, 0, igb, *registry, wh, wq, true), UI::Align::kLeft);
 	}
 
 // TODO(unknown): Implement UI for Builder + Soldiers

=== modified file 'src/wui/portdockwaresdisplay.h'
--- src/wui/portdockwaresdisplay.h	2014-09-10 08:55:04 +0000
+++ src/wui/portdockwaresdisplay.h	2016-02-05 15:56:21 +0000
@@ -33,7 +33,7 @@
 	 Widelands::WareWorker type);
 
 UI::Box * create_portdock_expedition_display
-	(UI::Panel * parent, Widelands::Warehouse & wh, InteractiveGameBase &);
+	(UI::Panel * parent, Widelands::Warehouse & wh, InteractiveGameBase &, UI::Window*& registry);
 
 
 #endif  // end of include guard: WL_WUI_PORTDOCKWARESDISPLAY_H

=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc	2016-01-31 21:03:15 +0000
+++ src/wui/productionsitewindow.cc	2016-02-05 15:56:21 +0000
@@ -60,7 +60,7 @@
 
 		for (uint32_t i = 0; i < warequeues.size(); ++i)
 			prod_box->add
-				(new WaresQueueDisplay(prod_box, 0, 0, igbase(), ps, warequeues[i]),
+				(new WaresQueueDisplay(prod_box, 0, 0, igbase(), *registry, ps, warequeues[i]),
 				 UI::Align::kLeft);
 
 		get_tabs()->add

=== modified file 'src/wui/warehousewindow.cc'
--- src/wui/warehousewindow.cc	2016-01-29 08:37:22 +0000
+++ src/wui/warehousewindow.cc	2016-02-05 15:56:21 +0000
@@ -232,7 +232,7 @@
 			get_tabs()->add
 				("expedition_wares_queue",
 				 g_gr->images().get(pic_tab_expedition),
-				 create_portdock_expedition_display(get_tabs(), warehouse(), igbase()),
+				 create_portdock_expedition_display(get_tabs(), warehouse(), igbase(), registry),
 				 _("Expedition"));
 		}
 	}

=== modified file 'src/wui/waresqueuedisplay.cc'
--- src/wui/waresqueuedisplay.cc	2016-01-31 21:03:15 +0000
+++ src/wui/waresqueuedisplay.cc	2016-02-05 15:56:21 +0000
@@ -37,12 +37,14 @@
 	(UI::Panel * const parent,
 	 int32_t const x, int32_t const y,
 	 InteractiveGameBase  & igb,
+	 UI::Window& registry,
 	 Widelands::Building   & building,
 	 Widelands::WaresQueue * const queue,
 	 bool show_only)
 :
 UI::Panel(parent, x, y, 0, 28),
 igb_(igb),
+registry_(registry),
 building_(building),
 queue_(queue),
 priority_radiogroup_(nullptr),
@@ -108,8 +110,14 @@
  */
 void WaresQueueDisplay::think()
 {
-	if (static_cast<uint32_t>(queue_->get_max_size()) != cache_size_)
+	// Prevent the content from leaking out with minimized windows
+	if (registry_.is_minimal()) {
+			return;
+	}
+
+	if (static_cast<uint32_t>(queue_->get_max_size()) != cache_size_) {
 		max_size_changed();
+	}
 
 	// 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_) {

=== modified file 'src/wui/waresqueuedisplay.h'
--- src/wui/waresqueuedisplay.h	2016-01-30 22:26:21 +0000
+++ src/wui/waresqueuedisplay.h	2016-02-05 15:56:21 +0000
@@ -29,6 +29,7 @@
 #include "ui_basic/button.h"
 #include "ui_basic/panel.h"
 #include "ui_basic/radiobutton.h"
+#include "ui_basic/window.h"
 
 class InteractiveGameBase;
 
@@ -60,6 +61,7 @@
 		(UI::Panel             * parent,
 		 int32_t x, int32_t y,
 		 InteractiveGameBase  & igb,
+		 UI::Window& registry,
 		 Widelands::Building   & building,
 		 Widelands::WaresQueue * queue,
 		 bool = false);
@@ -69,7 +71,8 @@
 	void draw(RenderTarget &) override;
 
 private:
-	InteractiveGameBase  & igb_;
+	InteractiveGameBase   & igb_;
+	UI::Window            & registry_;
 	Widelands::Building   & building_;
 	Widelands::WaresQueue * queue_;
 	UI::Radiogroup        * priority_radiogroup_;


Follow ups