summaryrefslogtreecommitdiff
path: root/Widgets/Window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Widgets/Window.cpp')
-rw-r--r--Widgets/Window.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Widgets/Window.cpp b/Widgets/Window.cpp
index 118c75cc27..2e0b95746e 100644
--- a/Widgets/Window.cpp
+++ b/Widgets/Window.cpp
@@ -46,6 +46,14 @@ void Window::event(Event& event)
if (event.isMouseEvent()) {
auto& me = static_cast<MouseEvent&>(event);
printf("Window{%p}: %s %d,%d\n", this, me.name(), me.x(), me.y());
+ if (m_mainWidget) {
+ auto result = m_mainWidget->hitTest(me.x(), me.y());
+ //printf("hit test for %d,%d found: %s{%p} %d,%d\n", me.x(), me.y(), result.widget->className(), result.widget, result.localX, result.localY);
+ // FIXME: Re-use the existing event instead of crafting a new one?
+ auto localEvent = make<MouseEvent>(event.type(), result.localX, result.localY, me.button());
+ result.widget->event(*localEvent);
+ return m_mainWidget->event(event);
+ }
return Object::event(event);
}
@@ -56,6 +64,7 @@ void Window::event(Event& event)
}
if (m_mainWidget)
return m_mainWidget->event(event);
+ return Object::event(event);
}
return Object::event(event);