vcl/osx/salframeview.mm | 35 ++++++++++++------------ vcl/osx/salgdiutils.cxx | 4 +- vcl/osx/salmenu.cxx | 8 ++--- vcl/osx/salnativewidgets.cxx | 4 +- vcl/quartz/AquaGraphicsBackend.cxx | 2 - vcl/source/window/menu.cxx | 2 - vcl/source/window/syswin.cxx | 2 - vcl/source/window/window.cxx | 4 +- vcl/source/window/winproc.cxx | 2 - vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx | 2 - vcl/unx/gtk3/gtkinst.cxx | 2 - vcl/unx/gtk3/gtksalmenu.cxx | 4 +- 12 files changed, 36 insertions(+), 35 deletions(-)
New commits: commit 22393b8f71d3a46a60ff0be5c938a5da6e5fabb0 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Sep 25 17:25:04 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Sep 26 07:11:28 2024 +0200 tdf#160837 macOS: Replace direct access to SalFrame::maGeometry Replace direct access to the (currently still public) SalFrame::maGeometry member in macOS code by using the public getter SalFrame::GetUnmirroredGeometry, or more specific getters for the height and width (SalFrame::GetWidth, SalFrame::GetHeight). Change-Id: Ic14fa480c58b09e5d0dd9ea7042d82c5f82c6eea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173956 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index eb8ed68add34..8c3e296d21ec 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -223,8 +223,9 @@ static void updateWinDataInLiveResize(bool bInLiveResize) mbInWindowDidResize = NO; mpLiveResizeTimer = nil; mpFrame = pFrame; - NSRect aRect = { { static_cast<CGFloat>(pFrame->maGeometry.x()), static_cast<CGFloat>(pFrame->maGeometry.y()) }, - { static_cast<CGFloat>(pFrame->maGeometry.width()), static_cast<CGFloat>(pFrame->maGeometry.height()) } }; + const SalFrameGeometry& rFrameGeometry = pFrame->GetUnmirroredGeometry(); + NSRect aRect = { { static_cast<CGFloat>(rFrameGeometry.x()), static_cast<CGFloat>(rFrameGeometry.y()) }, + { static_cast<CGFloat>(rFrameGeometry.width()), static_cast<CGFloat>(rFrameGeometry.height()) } }; pFrame->VCLToCocoa( aRect ); NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() @@ -744,7 +745,7 @@ static void updateWinDataInLiveResize(bool bInLiveResize) if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) { // FIXME: does this leak the returned NSCursor of getCurrentCursor ? - const NSRect aRect = { NSZeroPoint, NSMakeSize(mpFrame->maGeometry.width(), mpFrame->maGeometry.height()) }; + const NSRect aRect = { NSZeroPoint, NSMakeSize(mpFrame->GetUnmirroredGeometry().width(), mpFrame->GetUnmirroredGeometry().height()) }; [self addCursorRect: aRect cursor: mpFrame->getCurrentCursor()]; } } @@ -865,13 +866,13 @@ static void updateWinDataInLiveResize(bool bInLiveResize) SalMouseEvent aEvent; aEvent.mnTime = pDispatchFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - pDispatchFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - pDispatchFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - pDispatchFrame->GetUnmirroredGeometry().x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - pDispatchFrame->GetUnmirroredGeometry().y(); aEvent.mnButton = nButton; aEvent.mnCode = aEvent.mnButton | nModMask; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = pDispatchFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = pDispatchFrame->GetWidth() - 1 - aEvent.mnX; pDispatchFrame->CallCallback( nEvent, &aEvent ); @@ -1029,14 +1030,14 @@ static void updateWinDataInLiveResize(bool bInLiveResize) SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->GetUnmirroredGeometry().x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->GetUnmirroredGeometry().y(); aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling aEvent.mbDeltaIsPixel = true; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = mpFrame->GetWidth() - 1 - aEvent.mnX; aEvent.mnDelta = nDeltaZ; aEvent.mnNotchDelta = (nDeltaZ >= 0) ? +1 : -1; @@ -1086,13 +1087,13 @@ static void updateWinDataInLiveResize(bool bInLiveResize) SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->GetUnmirroredGeometry().x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->GetUnmirroredGeometry().y(); aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mbDeltaIsPixel = true; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = mpFrame->GetWidth() - 1 - aEvent.mnX; if( dX != 0.0 ) { @@ -1145,13 +1146,13 @@ static void updateWinDataInLiveResize(bool bInLiveResize) SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->GetUnmirroredGeometry().x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->GetUnmirroredGeometry().y(); aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mbDeltaIsPixel = false; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; + aEvent.mnX = mpFrame->GetWidth() - 1 - aEvent.mnX; if( dX != 0.0 ) { @@ -2135,8 +2136,8 @@ static void updateWinDataInLiveResize(bool bInLiveResize) if ( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) { - rect.origin.x = aPosEvent.mnX + mpFrame->maGeometry.x(); - rect.origin.y = aPosEvent.mnY + mpFrame->maGeometry.y() + 4; // add some space for underlines + rect.origin.x = aPosEvent.mnX + mpFrame->GetUnmirroredGeometry().x(); + rect.origin.y = aPosEvent.mnY + mpFrame->GetUnmirroredGeometry().y() + 4; // add some space for underlines rect.size.width = aPosEvent.mnWidth; rect.size.height = aPosEvent.mnHeight; diff --git a/vcl/osx/salgdiutils.cxx b/vcl/osx/salgdiutils.cxx index d7f8ec48eaf0..bbdbe64ac79f 100644 --- a/vcl/osx/salgdiutils.cxx +++ b/vcl/osx/salgdiutils.cxx @@ -206,8 +206,8 @@ bool AquaSharedAttributes::checkContext() { if (mbWindow && mpFrame && (mpFrame->getNSWindow() || Application::IsBitmapRendering())) { - const unsigned int nWidth = mpFrame->maGeometry.width(); - const unsigned int nHeight = mpFrame->maGeometry.height(); + const unsigned int nWidth = mpFrame->GetWidth(); + const unsigned int nHeight = mpFrame->GetHeight(); const float fScale = sal::aqua::getWindowScaling(); CGLayerRef rReleaseLayer = nullptr; diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index dcac168f7e53..4f4bc0e63169 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -312,8 +312,8 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectan // in mirrored UI case; best done by actually executing the same code sal_uInt16 nArrangeIndex; pWin->SetPosPixel( FloatingWindow::ImplCalcPos( pWin, rRect, nFlags, nArrangeIndex ) ); - displayPopupFrame.origin.x = pWin->ImplGetFrame()->maGeometry.x() - pParentAquaSalFrame->maGeometry.x() + offset; - displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.y() - pParentAquaSalFrame->maGeometry.y() + offset; + displayPopupFrame.origin.x = pWin->ImplGetFrame()->GetUnmirroredGeometry().x() - pParentAquaSalFrame->GetUnmirroredGeometry().x() + offset; + displayPopupFrame.origin.y = pWin->ImplGetFrame()->GetUnmirroredGeometry().y() - pParentAquaSalFrame->GetUnmirroredGeometry().y() + offset; pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false); // #i111992# if this menu was opened due to a key event, prevent dispatching that yet again @@ -841,8 +841,8 @@ SAL_WNODEPRECATED_DECLARATIONS_POP // make coordinates relative to reference frame static_cast<AquaSalFrame*>(i_pReferenceFrame)->CocoaToVCL( aRect.origin ); - aRect.origin.x -= i_pReferenceFrame->maGeometry.x(); - aRect.origin.y -= i_pReferenceFrame->maGeometry.y() + aRect.size.height; + aRect.origin.x -= i_pReferenceFrame->GetUnmirroredGeometry().x(); + aRect.origin.y -= i_pReferenceFrame->GetUnmirroredGeometry().y() + aRect.size.height; return tools::Rectangle( Point(static_cast<tools::Long>(aRect.origin.x), static_cast<tools::Long>(aRect.origin.y) diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 8a7e81fd5d86..7ff36f0cf690 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -1065,11 +1065,11 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, // strange effects start to happen when HIThemeDrawFrame meets the border of the window. // These can be avoided by clipping to the boundary of the frame (see issue 84756) - if (rc.origin.y + rc.size.height >= mpFrame->maGeometry.height() - 3) + if (rc.origin.y + rc.size.height >= mpFrame->GetHeight() - 3) { CGMutablePathRef rPath = CGPathCreateMutable(); CGPathAddRect(rPath, nullptr, - CGRectMake(0, 0, mpFrame->maGeometry.width() - 1, mpFrame->maGeometry.height() - 1)); + CGRectMake(0, 0, mpFrame->GetWidth() - 1, mpFrame->GetHeight() - 1)); CGContextBeginPath(context); CGContextAddPath(context, rPath); CGContextClip(context); diff --git a/vcl/quartz/AquaGraphicsBackend.cxx b/vcl/quartz/AquaGraphicsBackend.cxx index 4badefacf435..4b7358c83f94 100644 --- a/vcl/quartz/AquaGraphicsBackend.cxx +++ b/vcl/quartz/AquaGraphicsBackend.cxx @@ -264,7 +264,7 @@ tools::Long AquaGraphicsBackend::GetGraphicsWidth() const { if (mrShared.mbWindow && mrShared.mpFrame) { - width = mrShared.mpFrame->maGeometry.width(); + width = mrShared.mpFrame->GetWidth(); } } #endif commit 460b11312214bb4cf08cecc22a35699e9e7c1889 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Sep 25 16:33:10 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Sep 26 07:11:21 2024 +0200 tdf#160837 vcl: Use getter to get frame geometry Instead of directly accessing the (currently still public) class member SalFrame::maGeometry, use the getter that returns a const reference to it. Change-Id: Iac7dd70b82160acba06d8016d94a1ac4380e779e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173955 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 3ad46e1f3768..5a07e45e3064 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1600,7 +1600,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) // except on rather small screens // TODO: move GetScreenNumber from SystemWindow to Window ? // currently we rely on internal privileges - unsigned int nDisplayScreen = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.screen(); + unsigned int nDisplayScreen = pWin->ImplGetWindowImpl()->mpFrame->GetUnmirroredGeometry().screen(); tools::Rectangle aDispRect( Application::GetScreenPosSizePixel( nDisplayScreen ) ); tools::Long nScreenWidth = aDispRect.GetWidth() >= 800 ? aDispRect.GetWidth() : 800; if( nMaxWidth > nScreenWidth/2 ) diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index e37cb548daf1..ced6d530fc88 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -954,7 +954,7 @@ bool SystemWindow::ImplIsInTaskPaneList( vcl::Window* pWin ) unsigned int SystemWindow::GetScreenNumber() const { - return mpWindowImpl->mpFrame->maGeometry.screen(); + return mpWindowImpl->mpFrame->GetUnmirroredGeometry().screen(); } void SystemWindow::SetScreenNumber(unsigned int nDisplayScreen) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 4bad56a9544e..8ad82a2a58ff 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2257,7 +2257,7 @@ namespace // this is the relatively unusual case where pParent is the toplevel GtkSalFrame and not a stock GtkWidget // so use the same style of logic as GtkSalMenu::ShowNativePopupMenu to get the right position AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pFrame->GetWindow(), rInRect); - aFloatRect.Move(-pFrame->maGeometry.x(), -pFrame->maGeometry.y()); + aFloatRect.Move(-pFrame->GetUnmirroredGeometry().x(), -pFrame->GetUnmirroredGeometry().y()); rOutRect = GdkRectangle{static_cast<int>(aFloatRect.Left()), static_cast<int>(aFloatRect.Top()), static_cast<int>(aFloatRect.GetWidth()), static_cast<int>(aFloatRect.GetHeight())}; diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index fed134d179f9..a95d80a8c0ed 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -475,7 +475,7 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangl #if GTK_CHECK_VERSION(4, 0, 0) AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); - aFloatRect.Move(-mpFrame->maGeometry.x(), -mpFrame->maGeometry.y()); + aFloatRect.Move(-mpFrame->GetUnmirroredGeometry().x(), -mpFrame->GetUnmirroredGeometry().y()); GdkRectangle rect {static_cast<int>(aFloatRect.Left()), static_cast<int>(aFloatRect.Top()), static_cast<int>(aFloatRect.GetWidth()), static_cast<int>(aFloatRect.GetHeight())}; @@ -496,7 +496,7 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangl if (gtk_check_version(3, 22, 0) == nullptr) { AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); - aFloatRect.Move(-mpFrame->maGeometry.x(), -mpFrame->maGeometry.y()); + aFloatRect.Move(-mpFrame->GetUnmirroredGeometry().x(), -mpFrame->GetUnmirroredGeometry().y()); GdkRectangle rect {static_cast<int>(aFloatRect.Left()), static_cast<int>(aFloatRect.Top()), static_cast<int>(aFloatRect.GetWidth()), static_cast<int>(aFloatRect.GetHeight())}; commit 0879fff079965065935c88a1ba48385548176a13 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Sep 25 16:11:06 2024 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Sep 26 07:11:15 2024 +0200 tdf#160837 vcl: Use existing SalFrame::GetWidth Call `SalFrame::GetWidth` instead of directly accessing `SalFrame::maGeometry` and calling its `width()` method to simplify and abstract a bit from the implementation details in the callers. Change-Id: I06f960c4984e57a728c301e10fc62a28a8af6199 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173954 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 301b6c0cd51d..10db9fd7a3d2 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2727,7 +2727,7 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, } if( !comphelper::LibreOfficeKit::isActive() && !(nFlags & PosSizeFlags::X) && bHasValidSize && - pWindow->mpWindowImpl->mpFrame->maGeometry.width() ) + pWindow->mpWindowImpl->mpFrame->GetWidth()) { // RTL: make sure the old right aligned position is not changed // system windows will always grow to the right @@ -3606,7 +3606,7 @@ bool Window::IsScrollable() const void Window::ImplMirrorFramePos( Point &pt ) const { - pt.setX( mpWindowImpl->mpFrame->maGeometry.width()-1-pt.X() ); + pt.setX(mpWindowImpl->mpFrame->GetWidth() - 1 - pt.X()); } // frame based modal counter (dialogs are not modal to the whole application anymore) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 21e189cc8d33..fd7897fea5f6 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2771,7 +2771,7 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalEvent nEvent, const void* pE if( AllSettings::GetLayoutRTL() ) { SalFrame* pSalFrame = pWindow->ImplGetWindowImpl()->mpFrame; - const_cast<SalPaintEvent *>(pPaintEvt)->mnBoundX = pSalFrame->maGeometry.width() - pPaintEvt->mnBoundWidth - pPaintEvt->mnBoundX; + const_cast<SalPaintEvent *>(pPaintEvt)->mnBoundX = pSalFrame->GetWidth() - pPaintEvt->mnBoundWidth - pPaintEvt->mnBoundX; } tools::Rectangle aBoundRect( Point( pPaintEvt->mnBoundX, pPaintEvt->mnBoundY ), diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx index 5a751f9ea528..b21b39d6c731 100644 --- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx +++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx @@ -32,7 +32,7 @@ X11CairoSalGraphicsImpl::X11CairoSalGraphicsImpl(X11SalGraphics& rParent, CairoC tools::Long X11CairoSalGraphicsImpl::GetGraphicsWidth() const { if (mrParent.m_pFrame) - return mrParent.m_pFrame->maGeometry.width(); + return mrParent.m_pFrame->GetWidth(); return mrCairoCommon.m_pSurface ? mrCairoCommon.m_aFrameSize.getX() : 0; }
