← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1627537-window-mouserelease into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1627537-window-mouserelease into lp:widelands.

Commit message:
Cleaned up handle_mouserelease. This fixed the bug where editor tools wouldn't stop painting when the mouse button was released below a tools window.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1627537 in widelands: "Editor: Release mouse button does not work when placing things and mouse gets under a window"
  https://bugs.launchpad.net/widelands/+bug/1627537

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1627537-window-mouserelease/+merge/315986

This should fix the mouse release bug now.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1627537-window-mouserelease into lp:widelands.
=== modified file 'src/ui_basic/checkbox.cc'
--- src/ui_basic/checkbox.cc	2017-01-28 14:53:28 +0000
+++ src/ui_basic/checkbox.cc	2017-01-31 10:12:21 +0000
@@ -184,9 +184,6 @@
 	}
 	return false;
 }
-bool Statebox::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
-	return btn == SDL_BUTTON_LEFT;
-}
 
 bool Statebox::handle_mousemove(const uint8_t, int32_t, int32_t, int32_t, int32_t) {
 	return true;  // We handle this always by lighting up

=== modified file 'src/ui_basic/checkbox.h'
--- src/ui_basic/checkbox.h	2017-01-25 18:55:59 +0000
+++ src/ui_basic/checkbox.h	2017-01-31 10:12:21 +0000
@@ -70,7 +70,6 @@
 
 	void handle_mousein(bool inside) override;
 	bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
-	bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
 	bool handle_mousemove(uint8_t, int32_t, int32_t, int32_t, int32_t) override;
 
 private:

=== modified file 'src/ui_basic/tabpanel.cc'
--- src/ui_basic/tabpanel.cc	2017-01-25 18:55:59 +0000
+++ src/ui_basic/tabpanel.cc	2017-01-31 10:12:21 +0000
@@ -380,9 +380,6 @@
 	return false;
 }
 
-bool TabPanel::handle_mouserelease(uint8_t, int32_t, int32_t) {
-	return false;
-}
 
 /**
  * Find the tab at the coordinates x, y

=== modified file 'src/ui_basic/tabpanel.h'
--- src/ui_basic/tabpanel.h	2017-01-25 18:55:59 +0000
+++ src/ui_basic/tabpanel.h	2017-01-31 10:12:21 +0000
@@ -147,7 +147,6 @@
 	void draw(RenderTarget&) override;
 
 	bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
-	bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
 	bool
 	handle_mousemove(uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
 	void handle_mousein(bool inside) override;

=== modified file 'src/ui_fsmenu/helpwindow.cc'
--- src/ui_fsmenu/helpwindow.cc	2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/helpwindow.cc	2017-01-31 10:12:21 +0000
@@ -81,12 +81,9 @@
 	if (btn == SDL_BUTTON_RIGHT) {
 		play_click();
 		clicked_ok();
+		return true;
 	}
-	return true;
-}
-
-bool FullscreenHelpWindow::handle_mouserelease(const uint8_t, int32_t, int32_t) {
-	return true;
+	return false;
 }
 
 bool FullscreenHelpWindow::handle_key(bool down, SDL_Keysym code) {

=== modified file 'src/ui_fsmenu/helpwindow.h'
--- src/ui_fsmenu/helpwindow.h	2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/helpwindow.h	2017-01-31 10:12:21 +0000
@@ -42,7 +42,6 @@
 	                     uint32_t height = 0);
 
 	bool handle_mousepress(uint8_t btn, int32_t mx, int32_t my) override;
-	bool handle_mouserelease(uint8_t btn, int32_t mx, int32_t my) override;
 
 	/// Handle keypresses
 	bool handle_key(bool down, SDL_Keysym code) override;

=== modified file 'src/ui_fsmenu/intro.cc'
--- src/ui_fsmenu/intro.cc	2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/intro.cc	2017-01-31 10:12:21 +0000
@@ -37,10 +37,6 @@
 
 bool FullscreenMenuIntro::handle_mousepress(uint8_t, int32_t, int32_t) {
 	end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kOk);
-
-	return true;
-}
-bool FullscreenMenuIntro::handle_mouserelease(uint8_t, int32_t, int32_t) {
 	return true;
 }
 

=== modified file 'src/ui_fsmenu/intro.h'
--- src/ui_fsmenu/intro.h	2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/intro.h	2017-01-31 10:12:21 +0000
@@ -34,7 +34,6 @@
 
 protected:
 	bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
-	bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
 	bool handle_key(bool down, SDL_Keysym) override;
 
 private:

=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc	2017-01-25 18:55:59 +0000
+++ src/wui/mapview.cc	2017-01-31 10:12:21 +0000
@@ -483,9 +483,11 @@
 }
 
 bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
-	if (btn == SDL_BUTTON_RIGHT && dragging_)
+	if (btn == SDL_BUTTON_RIGHT && dragging_) {
 		stop_dragging();
-	return true;
+		return true;
+	}
+	return false;
 }
 
 bool MapView::handle_mousemove(

=== modified file 'src/wui/minimap.cc'
--- src/wui/minimap.cc	2017-01-25 18:55:59 +0000
+++ src/wui/minimap.cc	2017-01-31 10:12:21 +0000
@@ -70,9 +70,6 @@
 	return true;
 }
 
-bool MiniMap::View::handle_mouserelease(uint8_t const btn, int32_t, int32_t) {
-	return btn == SDL_BUTTON_LEFT;
-}
 
 void MiniMap::View::set_zoom(int32_t z) {
 	const Widelands::Map& map = ibase_.egbase().map();

=== modified file 'src/wui/minimap.h'
--- src/wui/minimap.h	2017-01-25 18:55:59 +0000
+++ src/wui/minimap.h	2017-01-31 10:12:21 +0000
@@ -76,7 +76,6 @@
 		void draw(RenderTarget&) override;
 
 		bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
-		bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
 
 		void set_zoom(int32_t z);
 


Follow ups