fix bounds check for focus event
This commit is contained in:
parent
1f04b5d1dc
commit
f14d88c776
1 changed files with 3 additions and 12 deletions
|
@ -153,8 +153,6 @@ void Widget::handle_reflow(ReflowEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::handle_mouse_move_event(MouseMoveEvent &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;
|
bool update_focus_to = true;
|
||||||
|
|
||||||
std::cout << "point: " << event.point().x() << ", " << event.point().y() << std::endl;
|
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) {
|
if (m_is_focused) {
|
||||||
update_focus_to = false;
|
update_focus_to = false;
|
||||||
} else {
|
} else {
|
||||||
|
event.accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,16 +175,8 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) {
|
||||||
on_focus_update(focus_update_event);
|
on_focus_update(focus_update_event);
|
||||||
on_mouse_move(event);
|
on_mouse_move(event);
|
||||||
|
|
||||||
if (!m_consumes_hits) {
|
if (m_consumes_hits) {
|
||||||
for (auto &c : children()) {
|
event.accept();
|
||||||
auto e = MouseMoveEvent {
|
|
||||||
Point {
|
|
||||||
event.point().x() - current_geometry().x(),
|
|
||||||
event.point().y() - current_geometry().y()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
c->dispatch_event(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_is_focused && m_window)
|
if (m_is_focused && m_window)
|
||||||
|
|
Loading…
Reference in a new issue