widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11123
[Merge] lp:~widelands-dev/widelands/fix_ui_bugs into lp:widelands
SirVer has proposed merging lp:~widelands-dev/widelands/fix_ui_bugs into lp:widelands.
Commit message:
- Revert behavior of watch window to b19: do not close when right clicked into it.
- Fix event passing for mousewheel events.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1714808 in widelands: "Zooming is difficult in editor"
https://bugs.launchpad.net/widelands/+bug/1714808
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fix_ui_bugs/+merge/330176
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fix_ui_bugs into lp:widelands.
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2017-05-31 21:27:07 +0000
+++ src/ui_basic/panel.cc 2017-09-04 19:15:22 +0000
@@ -820,7 +820,6 @@
}
bool Panel::do_mousewheel(uint32_t which, int32_t x, int32_t y, Vector2i rel_mouse_pos) {
-
// Check if a child-panel is beneath the mouse and processes the event
for (Panel* child = first_child_; child; child = child->next_) {
if (!child->handles_mouse() || !child->is_visible()) {
@@ -838,11 +837,7 @@
child->get_y() + child->get_tborder()))) {
return true;
}
- // Break after the first hit panel in the list. The panels are ordered from top to bottom,
- // so only the highest window at the current mouse coordinates receives the event
- break;
}
-
return handle_mousewheel(which, x, y);
}
=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc 2017-08-16 13:23:15 +0000
+++ src/ui_basic/window.cc 2017-09-04 19:15:22 +0000
@@ -399,6 +399,12 @@
return true;
}
+bool Window::handle_mousewheel(uint32_t which, int32_t x, int32_t y) {
+ // Mouse wheel events should not propagate to objects below us, so we claim
+ // that they have been handled.
+ return true;
+}
+
/**
* Close the window. Overwrite this virtual method if you want
* to take some action before the window is destroyed, or to
=== modified file 'src/ui_basic/window.h'
--- src/ui_basic/window.h 2017-06-24 10:38:19 +0000
+++ src/ui_basic/window.h 2017-09-04 19:15:22 +0000
@@ -95,6 +95,7 @@
bool handle_mouserelease(uint8_t btn, int32_t mx, int32_t my) override;
bool
handle_mousemove(uint8_t state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
+ bool handle_mousewheel(uint32_t which, int32_t x, int32_t y) override;
bool handle_tooltip() override;
protected:
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2017-09-02 19:36:19 +0000
+++ src/wui/interactive_base.cc 2017-09-04 19:15:22 +0000
@@ -827,7 +827,7 @@
}
}
- return map_view_.handle_key(down, code);
+ return false;
}
void InteractiveBase::cmd_lua(const std::vector<std::string>& args) {
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2017-09-01 18:59:42 +0000
+++ src/wui/mapview.cc 2017-09-04 19:15:22 +0000
@@ -447,10 +447,14 @@
stop_dragging();
const auto node_and_triangle = track_sel(Vector2i(x, y));
field_clicked(node_and_triangle);
- } else if (btn == SDL_BUTTON_RIGHT) {
+ // Do not return true, because we want to give our parent a chance to
+ // also handle the click.
+ }
+ if (btn == SDL_BUTTON_RIGHT) {
dragging_ = true;
grab_mouse(true);
WLApplication::get()->set_mouse_lock(true);
+ return true;
}
return false;
}
@@ -458,6 +462,7 @@
bool MapView::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
if (btn == SDL_BUTTON_RIGHT && dragging_) {
stop_dragging();
+ return true;
}
return false;
}
Follow ups