From 987c03d5c237c6a86ac886991435220e7381ced1 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Thu, 9 May 2019 22:49:37 -0400 Subject: LOK: Do not offset window coordinates in LOK This fixes the issue with selecting the incorrect color when clicking on the color presets in the color picker window in LOK. Because the window coordinates are shifted in Core, and LOK client sends in absolute coordinates, the shift causes a different color to be selected. (cherry picked from commit 171a2300d37d73065e5e3bd4b77678e35f678adf) Change-Id: Ib818b83c0f0c727944068cb244f8d10666e5bc1d Reviewed-on: https://gerrit.libreoffice.org/76323 Tested-by: Jenkins Reviewed-by: Noel Grandin --- desktop/source/lib/init.cxx | 2 +- vcl/source/app/svapp.cxx | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ebb52d175027..42972ce713b5 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3278,7 +3278,7 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned return; } - Point aPos(nX, nY); + const Point aPos(nX, nY); MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); if (Dialog* pDialog = dynamic_cast(pWindow.get())) diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 4967144e38e4..6632364f1c6c 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include #include @@ -880,8 +881,12 @@ ImplSVEvent* Application::PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, { Point aTransformedPos( pMouseEvent->GetPosPixel() ); - aTransformedPos.AdjustX(pWin->GetOutOffXPixel() ); - aTransformedPos.AdjustY(pWin->GetOutOffYPixel() ); + // LOK uses (0, 0) as the origin of all windows; don't offset. + if (!comphelper::LibreOfficeKit::isActive()) + { + aTransformedPos.AdjustX(pWin->GetOutOffXPixel()); + aTransformedPos.AdjustY(pWin->GetOutOffYPixel()); + } const MouseEvent aTransformedEvent( aTransformedPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(), pMouseEvent->GetButtons(), pMouseEvent->GetModifier() ); -- cgit