vcl/inc/salframe.hxx | 4 ++-- vcl/qt5/QtFrame.cxx | 17 +++++++++-------- vcl/source/gdi/salgdilayout.cxx | 13 +++++++------ 3 files changed, 18 insertions(+), 16 deletions(-)
New commits: commit b2743ac25485f0909838fae370401e21ee85950f Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Sep 26 15:33:29 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Sep 28 09:31:55 2024 +0200 tdf#160837 SalFrame: Replace direct uses of maGeometry member Call `GetUnmirroredGeometry()` instead of directly using the `maGeometry` member in order to get the current SalFrameGeometry. This is in preparation of allowing to override `SalFrame::GetUnmirroredGeometry` in subclasses in an upcoming commit. No change in behavior intended (yet). Change-Id: I72b44052ba5e8ed61a1c54130ea088f1bb0b3941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173995 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index aec104b43175..e5e833c68796 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -126,8 +126,8 @@ public: virtual ~SalFrame() override; // SalGeometryProvider - virtual tools::Long GetWidth() const override { return maGeometry.width(); } - virtual tools::Long GetHeight() const override { return maGeometry.height(); } + virtual tools::Long GetWidth() const override { return GetUnmirroredGeometry().width(); } + virtual tools::Long GetHeight() const override { return GetUnmirroredGeometry().height(); } virtual bool IsOffScreen() const override { return false; } // SalGraphics or NULL, but two Graphics for all SalFrames diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 0a5eb5140a39..9678c7ee674e 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -36,17 +36,18 @@ SalFrameGeometry SalFrame::GetGeometry() const { + SalFrameGeometry aGeometry = GetUnmirroredGeometry(); + // mirror frame coordinates at parent SalFrame *pParent = GetParent(); if( pParent && AllSettings::GetLayoutRTL() ) { - SalFrameGeometry aGeom = maGeometry; - const int nParentX = aGeom.x() - pParent->maGeometry.x(); - aGeom.setX(pParent->maGeometry.x() + pParent->maGeometry.width() - maGeometry.width() - nParentX); - return aGeom; + SalFrameGeometry aParentGeometry = pParent->GetUnmirroredGeometry(); + const int nParentX = aGeometry.x() - aParentGeometry.x(); + aGeometry.setX(aParentGeometry.x() + aParentGeometry.width() - aGeometry.width() - nParentX); } - else - return maGeometry; + + return aGeometry; } SalGraphics::SalGraphics() commit 54bdc8cb95584aba8de06564ea45f05d0babc032 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Sep 26 15:20:57 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Sep 28 09:31:47 2024 +0200 tdf#160837 qt: QtFrame: Use getters instead of SalFrame::maGeometry Replace some direct uses of SalFrame::maGeometry in QtFrame with corresponding getters: * SalFrame::GetUnmirroredGeometry() to get the SalFrameGeometry * the more specific SalFrame::GetWidth() and SalFrame::GetHeight() where only the width/ height is of interest No change in behavior intended yet. Change-Id: I1b4e13c5efef7b78f082f6444e1e8d0ee591db41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173994 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 2e2bd9dd59ec..99375eb72a7f 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -546,9 +546,9 @@ void QtFrame::SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, too if (isChild(false) || !m_pQWidget->isMaximized()) { if (!(nFlags & SAL_FRAME_POSSIZE_WIDTH)) - nWidth = maGeometry.width(); + nWidth = GetWidth(); else if (!(nFlags & SAL_FRAME_POSSIZE_HEIGHT)) - nHeight = maGeometry.height(); + nHeight = GetHeight(); if (nWidth > 0 && nHeight > 0) { @@ -579,18 +579,18 @@ void QtFrame::SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, too if (m_pParent) { - const SalFrameGeometry& aParentGeometry = m_pParent->maGeometry; + const SalFrameGeometry aParentGeometry = m_pParent->GetUnmirroredGeometry(); if (QGuiApplication::isRightToLeft()) - nX = aParentGeometry.x() + aParentGeometry.width() - nX - maGeometry.width() - 1; + nX = aParentGeometry.x() + aParentGeometry.width() - nX - GetWidth() - 1; else nX += aParentGeometry.x(); nY += aParentGeometry.y() + menuBarOffset(); } if (!(nFlags & SAL_FRAME_POSSIZE_X)) - nX = maGeometry.x(); + nX = GetUnmirroredGeometry().x(); else if (!(nFlags & SAL_FRAME_POSSIZE_Y)) - nY = maGeometry.y(); + nY = GetUnmirroredGeometry().y(); // assume the reposition happened // needed for calculations and will eventually be corrected by events later @@ -856,7 +856,7 @@ bool QtFrame::ShowTooltip(const OUString& rText, const tools::Rectangle& rHelpAr { QRect aHelpArea(toQRect(rHelpArea)); if (QGuiApplication::isRightToLeft()) - aHelpArea.moveLeft(maGeometry.width() - aHelpArea.width() - aHelpArea.left() - 1); + aHelpArea.moveLeft(GetWidth() - aHelpArea.width() - aHelpArea.left() - 1); m_aTooltipText = rText; m_aTooltipArea = aHelpArea; return true; @@ -1273,7 +1273,8 @@ SalFrame::SalPointerState QtFrame::GetPointerState() { SalPointerState aState; aState.maPos = toPoint(QCursor::pos() * devicePixelRatioF()); - aState.maPos.Move(-maGeometry.x(), -maGeometry.y()); + SalFrameGeometry aGeometry = GetUnmirroredGeometry(); + aState.maPos.Move(-aGeometry.x(), -aGeometry.y()); aState.mnState = GetMouseModCode(QGuiApplication::mouseButtons()) | GetKeyModCode(QGuiApplication::keyboardModifiers()); return aState;