From f14d88c776315ba1717f66650a2412a028c800c7 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Mon, 6 Jun 2022 00:03:01 +0300 Subject: [PATCH] fix bounds check for focus event --- src/Widget.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Widget.cpp b/src/Widget.cpp index bd43c50..82baaa8 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -153,8 +153,6 @@ void Widget::handle_reflow(ReflowEvent &event) { } void Widget::handle_mouse_move_event(MouseMoveEvent &event) { - event.accept(); // we will do our own propagation logic. TODO: remove automatic event propagation? - bool update_focus_to = true; std::cout << "point: " << event.point().x() << ", " << event.point().y() << std::endl; @@ -164,6 +162,7 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) { if (m_is_focused) { update_focus_to = false; } else { + event.accept(); return; } } @@ -176,16 +175,8 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) { on_focus_update(focus_update_event); on_mouse_move(event); - if (!m_consumes_hits) { - for (auto &c : children()) { - auto e = MouseMoveEvent { - Point { - event.point().x() - current_geometry().x(), - event.point().y() - current_geometry().y() - } - }; - c->dispatch_event(e); - } + if (m_consumes_hits) { + event.accept(); } if (m_is_focused && m_window)