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

Proposed by GunChleoc
Status: Merged
Merged at revision: 8278
Proposed branch: lp:~widelands-dev/widelands/bug-1627537-window-mouserelease
Merge into: lp:widelands
Diff against target: 280 lines (+10/-41)
20 files modified
src/ui_basic/button.cc (+2/-1)
src/ui_basic/checkbox.cc (+0/-3)
src/ui_basic/checkbox.h (+0/-1)
src/ui_basic/editbox.cc (+0/-3)
src/ui_basic/editbox.h (+0/-1)
src/ui_basic/listselect.cc (+0/-3)
src/ui_basic/listselect.h (+0/-1)
src/ui_basic/slider.cc (+2/-1)
src/ui_basic/table.cc (+0/-3)
src/ui_basic/table.h (+0/-2)
src/ui_basic/tabpanel.cc (+0/-3)
src/ui_basic/tabpanel.h (+0/-1)
src/ui_basic/window.cc (+0/-1)
src/ui_fsmenu/helpwindow.cc (+2/-5)
src/ui_fsmenu/helpwindow.h (+0/-1)
src/ui_fsmenu/intro.cc (+0/-4)
src/ui_fsmenu/intro.h (+0/-1)
src/wui/mapview.cc (+4/-2)
src/wui/minimap.cc (+0/-3)
src/wui/minimap.h (+0/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1627537-window-mouserelease
Reviewer Review Type Date Requested Status
kaputtnik (community) testing Approve
GunChleoc Needs Resubmitting
SirVer Approve
Review via email: mp+315986@code.launchpad.net

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.

Description of the change

This should fix the mouse release bug now.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1894. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/196908113.
Appveyor build 1729. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1627537_window_mouserelease-1729.

Revision history for this message
SirVer (sirver) wrote :

code lgtm. not tested.

review: Approve
Revision history for this message
kaputtnik (franku) wrote :

Sorry, the bug is not fixed here with this branch.

review: Needs Fixing
Revision history for this message
GunChleoc (gunchleoc) wrote :

I must have accidentally changed something after my last test. Fixed now.

review: Needs Resubmitting
Revision history for this message
kaputtnik (franku) wrote :

The old behavior still applies if the mouse button get released on a highlighted button. E.g. open tools -> terrain height menu and tools -> terrain menu. Choose water, hold down left mouse button and move the mouse to one of the buttons in the change height window. Releasing the mouse button then brings back the old behavior.

This happens for all menus which contain such buttons: Main menu, Tool size menu, Resources menu, Players menu and also the Minimap (here the small buttons below the minimap).

Don't know if this should be fixed also. I guess the chance to release the mouse button just on such buttons is very small. Nevertheless it shouldn't happen, imho.

Feel free to merge this one without fixing this issues :-)

Revision history for this message
GunChleoc (gunchleoc) wrote :

That was actually an easy fix - could you do a final test?

Revision history for this message
kaputtnik (franku) wrote :

Perfect :-)

@bunnybot merge

review: Approve (testing)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ui_basic/button.cc'
2--- src/ui_basic/button.cc 2017-01-25 18:55:59 +0000
3+++ src/ui_basic/button.cc 2017-02-09 16:46:31 +0000
4@@ -326,8 +326,9 @@
5 // closed the dialog that it is part of). So member variables may no
6 // longer be accessed.
7 }
8+ return true;
9 }
10- return true;
11+ return false;
12 }
13
14 bool Button::handle_mousemove(const uint8_t, int32_t, int32_t, int32_t, int32_t) {
15
16=== modified file 'src/ui_basic/checkbox.cc'
17--- src/ui_basic/checkbox.cc 2017-01-28 14:53:28 +0000
18+++ src/ui_basic/checkbox.cc 2017-02-09 16:46:31 +0000
19@@ -184,9 +184,6 @@
20 }
21 return false;
22 }
23-bool Statebox::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
24- return btn == SDL_BUTTON_LEFT;
25-}
26
27 bool Statebox::handle_mousemove(const uint8_t, int32_t, int32_t, int32_t, int32_t) {
28 return true; // We handle this always by lighting up
29
30=== modified file 'src/ui_basic/checkbox.h'
31--- src/ui_basic/checkbox.h 2017-01-25 18:55:59 +0000
32+++ src/ui_basic/checkbox.h 2017-02-09 16:46:31 +0000
33@@ -70,7 +70,6 @@
34
35 void handle_mousein(bool inside) override;
36 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
37- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
38 bool handle_mousemove(uint8_t, int32_t, int32_t, int32_t, int32_t) override;
39
40 private:
41
42=== modified file 'src/ui_basic/editbox.cc'
43--- src/ui_basic/editbox.cc 2017-02-09 14:41:55 +0000
44+++ src/ui_basic/editbox.cc 2017-02-09 16:46:31 +0000
45@@ -180,9 +180,6 @@
46
47 return false;
48 }
49-bool EditBox::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
50- return btn == SDL_BUTTON_LEFT && get_can_focus();
51-}
52
53 /**
54 * Handle keypress/release events
55
56=== modified file 'src/ui_basic/editbox.h'
57--- src/ui_basic/editbox.h 2017-01-25 18:55:59 +0000
58+++ src/ui_basic/editbox.h 2017-02-09 16:46:31 +0000
59@@ -67,7 +67,6 @@
60 }
61
62 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
63- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
64 bool handle_key(bool down, SDL_Keysym) override;
65 bool handle_textinput(const std::string& text) override;
66
67
68=== modified file 'src/ui_basic/listselect.cc'
69--- src/ui_basic/listselect.cc 2017-01-25 18:55:59 +0000
70+++ src/ui_basic/listselect.cc 2017-02-09 16:46:31 +0000
71@@ -487,9 +487,6 @@
72 }
73 }
74
75-bool BaseListselect::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
76- return btn == SDL_BUTTON_LEFT;
77-}
78
79 bool BaseListselect::handle_mousemove(uint8_t, int32_t, int32_t y, int32_t, int32_t) {
80 y = (y + scrollpos_) / get_lineheight();
81
82=== modified file 'src/ui_basic/listselect.h'
83--- src/ui_basic/listselect.h 2017-01-25 18:55:59 +0000
84+++ src/ui_basic/listselect.h 2017-02-09 16:46:31 +0000
85@@ -120,7 +120,6 @@
86 // Drawing and event handling
87 void draw(RenderTarget&) override;
88 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
89- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
90 bool
91 handle_mousemove(uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
92 bool handle_mousewheel(uint32_t which, int32_t x, int32_t y) override;
93
94=== modified file 'src/ui_basic/slider.cc'
95--- src/ui_basic/slider.cc 2017-02-09 14:41:55 +0000
96+++ src/ui_basic/slider.cc 2017-02-09 16:46:31 +0000
97@@ -244,8 +244,9 @@
98
99 // cursor position: align to integer value
100 calculate_cursor_position();
101+ return true;
102 }
103- return true;
104+ return false;
105 }
106
107 /**
108
109=== modified file 'src/ui_basic/table.cc'
110--- src/ui_basic/table.cc 2017-01-25 18:55:59 +0000
111+++ src/ui_basic/table.cc 2017-02-09 16:46:31 +0000
112@@ -434,9 +434,6 @@
113 return false;
114 }
115 }
116-bool Table<void*>::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
117- return btn == SDL_BUTTON_LEFT;
118-}
119
120 /**
121 * move the currently selected entry up or down.
122
123=== modified file 'src/ui_basic/table.h'
124--- src/ui_basic/table.h 2017-01-25 18:55:59 +0000
125+++ src/ui_basic/table.h 2017-02-09 16:46:31 +0000
126@@ -111,7 +111,6 @@
127 // Drawing and event handling
128 void draw(RenderTarget&);
129 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y);
130- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y);
131 bool handle_mousewheel(uint32_t which, int32_t x, int32_t y);
132 virtual bool handle_key(bool down, SDL_Keysym code);
133 };
134@@ -271,7 +270,6 @@
135 // Drawing and event handling
136 void draw(RenderTarget&) override;
137 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
138- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
139 bool handle_mousewheel(uint32_t which, int32_t x, int32_t y) override;
140 bool handle_key(bool down, SDL_Keysym code) override;
141
142
143=== modified file 'src/ui_basic/tabpanel.cc'
144--- src/ui_basic/tabpanel.cc 2017-01-25 18:55:59 +0000
145+++ src/ui_basic/tabpanel.cc 2017-02-09 16:46:31 +0000
146@@ -380,9 +380,6 @@
147 return false;
148 }
149
150-bool TabPanel::handle_mouserelease(uint8_t, int32_t, int32_t) {
151- return false;
152-}
153
154 /**
155 * Find the tab at the coordinates x, y
156
157=== modified file 'src/ui_basic/tabpanel.h'
158--- src/ui_basic/tabpanel.h 2017-01-25 18:55:59 +0000
159+++ src/ui_basic/tabpanel.h 2017-02-09 16:46:31 +0000
160@@ -147,7 +147,6 @@
161 void draw(RenderTarget&) override;
162
163 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
164- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
165 bool
166 handle_mousemove(uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
167 void handle_mousein(bool inside) override;
168
169=== modified file 'src/ui_basic/window.cc'
170--- src/ui_basic/window.cc 2017-01-30 08:08:29 +0000
171+++ src/ui_basic/window.cc 2017-02-09 16:46:31 +0000
172@@ -387,7 +387,6 @@
173 if (btn == SDL_BUTTON_LEFT) {
174 grab_mouse(false);
175 dragging_ = false;
176- return true;
177 }
178 return false;
179 }
180
181=== modified file 'src/ui_fsmenu/helpwindow.cc'
182--- src/ui_fsmenu/helpwindow.cc 2017-01-25 18:55:59 +0000
183+++ src/ui_fsmenu/helpwindow.cc 2017-02-09 16:46:31 +0000
184@@ -81,12 +81,9 @@
185 if (btn == SDL_BUTTON_RIGHT) {
186 play_click();
187 clicked_ok();
188+ return true;
189 }
190- return true;
191-}
192-
193-bool FullscreenHelpWindow::handle_mouserelease(const uint8_t, int32_t, int32_t) {
194- return true;
195+ return false;
196 }
197
198 bool FullscreenHelpWindow::handle_key(bool down, SDL_Keysym code) {
199
200=== modified file 'src/ui_fsmenu/helpwindow.h'
201--- src/ui_fsmenu/helpwindow.h 2017-01-25 18:55:59 +0000
202+++ src/ui_fsmenu/helpwindow.h 2017-02-09 16:46:31 +0000
203@@ -42,7 +42,6 @@
204 uint32_t height = 0);
205
206 bool handle_mousepress(uint8_t btn, int32_t mx, int32_t my) override;
207- bool handle_mouserelease(uint8_t btn, int32_t mx, int32_t my) override;
208
209 /// Handle keypresses
210 bool handle_key(bool down, SDL_Keysym code) override;
211
212=== modified file 'src/ui_fsmenu/intro.cc'
213--- src/ui_fsmenu/intro.cc 2017-01-25 18:55:59 +0000
214+++ src/ui_fsmenu/intro.cc 2017-02-09 16:46:31 +0000
215@@ -37,10 +37,6 @@
216
217 bool FullscreenMenuIntro::handle_mousepress(uint8_t, int32_t, int32_t) {
218 end_modal<FullscreenMenuBase::MenuTarget>(FullscreenMenuBase::MenuTarget::kOk);
219-
220- return true;
221-}
222-bool FullscreenMenuIntro::handle_mouserelease(uint8_t, int32_t, int32_t) {
223 return true;
224 }
225
226
227=== modified file 'src/ui_fsmenu/intro.h'
228--- src/ui_fsmenu/intro.h 2017-01-25 18:55:59 +0000
229+++ src/ui_fsmenu/intro.h 2017-02-09 16:46:31 +0000
230@@ -34,7 +34,6 @@
231
232 protected:
233 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
234- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
235 bool handle_key(bool down, SDL_Keysym) override;
236
237 private:
238
239=== modified file 'src/wui/mapview.cc'
240--- src/wui/mapview.cc 2017-02-06 20:03:20 +0000
241+++ src/wui/mapview.cc 2017-02-09 16:46:31 +0000
242@@ -485,9 +485,11 @@
243 }
244
245 bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
246- if (btn == SDL_BUTTON_RIGHT && dragging_)
247+ if (btn == SDL_BUTTON_RIGHT && dragging_) {
248 stop_dragging();
249- return true;
250+ return true;
251+ }
252+ return false;
253 }
254
255 bool MapView::handle_mousemove(
256
257=== modified file 'src/wui/minimap.cc'
258--- src/wui/minimap.cc 2017-01-25 18:55:59 +0000
259+++ src/wui/minimap.cc 2017-02-09 16:46:31 +0000
260@@ -70,9 +70,6 @@
261 return true;
262 }
263
264-bool MiniMap::View::handle_mouserelease(uint8_t const btn, int32_t, int32_t) {
265- return btn == SDL_BUTTON_LEFT;
266-}
267
268 void MiniMap::View::set_zoom(int32_t z) {
269 const Widelands::Map& map = ibase_.egbase().map();
270
271=== modified file 'src/wui/minimap.h'
272--- src/wui/minimap.h 2017-01-25 18:55:59 +0000
273+++ src/wui/minimap.h 2017-02-09 16:46:31 +0000
274@@ -76,7 +76,6 @@
275 void draw(RenderTarget&) override;
276
277 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
278- bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
279
280 void set_zoom(int32_t z);
281

Subscribers

People subscribed via source and target branches

to status/vote changes: