[Libreoffice-commits] core.git: vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 17 20:16:06 UTC 2020
vcl/source/app/salvtables.cxx | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
New commits:
commit 65cc604f68963705baca6906daa1b264b657e5a2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jun 17 16:37:06 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 17 22:15:28 2020 +0200
translate child co-ords to parent space
Change-Id: I108187203d284726a9d63712666ddb029525a993
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96552
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 222def7b8bdf..8b3677da1c86 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -534,34 +534,61 @@ void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent)
m_aSizeAllocateHdl.Call(m_xWidget->GetSizePixel());
}
+namespace
+{
+ MouseEvent TransformEvent(const MouseEvent& rEvent, const vcl::Window* pParent, const vcl::Window* pChild)
+ {
+ return MouseEvent(pParent->ScreenToOutputPixel(pChild->OutputToScreenPixel(rEvent.GetPosPixel())),
+ rEvent.GetClicks(), rEvent.GetMode(), rEvent.GetButtons(), rEvent.GetModifier());
+ }
+}
+
void SalInstanceWidget::HandleMouseEventListener(VclSimpleEvent& rEvent)
{
if (rEvent.GetId() == VclEventId::WindowMouseButtonDown)
{
auto& rWinEvent = static_cast<VclWindowEvent&>(rEvent);
- if (m_xWidget->IsWindowOrChild(rWinEvent.GetWindow()))
+ if (m_xWidget == rWinEvent.GetWindow())
{
const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rWinEvent.GetData());
m_aMousePressHdl.Call(*pMouseEvent);
}
+ else if (m_xWidget->ImplIsChild(rWinEvent.GetWindow()))
+ {
+ const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rWinEvent.GetData());
+ const MouseEvent aTransformedEvent(TransformEvent(*pMouseEvent, m_xWidget, rWinEvent.GetWindow()));
+ m_aMousePressHdl.Call(aTransformedEvent);
+ }
}
else if (rEvent.GetId() == VclEventId::WindowMouseButtonUp)
{
auto& rWinEvent = static_cast<VclWindowEvent&>(rEvent);
- if (m_xWidget->IsWindowOrChild(rWinEvent.GetWindow()))
+ if (m_xWidget == rWinEvent.GetWindow())
{
const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rWinEvent.GetData());
m_aMouseReleaseHdl.Call(*pMouseEvent);
}
+ else if (m_xWidget->ImplIsChild(rWinEvent.GetWindow()))
+ {
+ const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rWinEvent.GetData());
+ const MouseEvent aTransformedEvent(TransformEvent(*pMouseEvent, m_xWidget, rWinEvent.GetWindow()));
+ m_aMouseReleaseHdl.Call(aTransformedEvent);
+ }
}
else if (rEvent.GetId() == VclEventId::WindowMouseMove)
{
auto& rWinEvent = static_cast<VclWindowEvent&>(rEvent);
- if (m_xWidget->IsWindowOrChild(rWinEvent.GetWindow()))
+ if (m_xWidget == rWinEvent.GetWindow())
{
const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rWinEvent.GetData());
m_aMouseMotionHdl.Call(*pMouseEvent);
}
+ else if (m_xWidget->ImplIsChild(rWinEvent.GetWindow()))
+ {
+ const MouseEvent* pMouseEvent = static_cast<const MouseEvent*>(rWinEvent.GetData());
+ const MouseEvent aTransformedEvent(TransformEvent(*pMouseEvent, m_xWidget, rWinEvent.GetWindow()));
+ m_aMouseMotionHdl.Call(aTransformedEvent);
+ }
}
}
More information about the Libreoffice-commits
mailing list