diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-06-02 22:42:20 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-06-08 18:17:17 +0200 |
commit | ea5a0918c8c32309821ab239c4b95f4d6a3b5c12 (patch) | |
tree | 04ff84b7c076a2f178e90d0eb32eb1731b10fd3c /vcl/osx | |
parent | d4123356c61db269651e950a0a2cc93e6d801c90 (diff) |
VCL add vcl::WindowPosSize abstract class
... and use it to remove a duplicate and simplify code.
Should mostly be a refactoring, which was mainly done by some
larger sed calls, except for the new API calls, which helped
shrinking some LOC. All data is also now private.
Originally two of the "replaced" "classes" had unsigned width
and height and one had signed. Noel pointed out, that during
calculations, the value might get negative temporarly, so this
now settles with signed values. Still the set size should never
be negative and this is enforced this way. Not sure that is what
Noel had in mind.
This also includes:
- rename WindowState => WindowData
- rename WindowStateMask => WindowDataMask
- rename WindowStateState => WindowState
- move WindowState and WindowDataMask to vcl/windowstate.hxx
- move WindowData(Mask) and WindowState into vcl namespace
- readability: replace or'ed WindowState enums with "meta" enums
+ add "meta" WindowState enums PosSize and PosSizeState
Change-Id: Icd16cfb498531aa7238ddbde83fcb0ed6d9e4f77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135426
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/osx')
-rw-r--r-- | vcl/osx/salframe.cxx | 183 | ||||
-rw-r--r-- | vcl/osx/salframeview.mm | 34 | ||||
-rw-r--r-- | vcl/osx/salgdiutils.cxx | 4 | ||||
-rw-r--r-- | vcl/osx/salmenu.cxx | 8 | ||||
-rw-r--r-- | vcl/osx/salnativewidgets.cxx | 4 |
5 files changed, 111 insertions, 122 deletions
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index a5356fcf19be..e90b7edbf258 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -110,7 +110,7 @@ AquaSalFrame::AquaSalFrame( SalFrame* pParent, SalFrameStyleFlags salFrameStyle AquaSalFrame::~AquaSalFrame() { if (mbFullScreen) - doShowFullScreen(false, maGeometry.nDisplayScreenNumber); + doShowFullScreen(false, maGeometry.screen()); assert( GetSalData()->mpInstance->IsMainThread() ); @@ -168,10 +168,10 @@ void AquaSalFrame::initWindowAndView() NSRect aVisibleRect = [pNSScreen visibleFrame]; CocoaToVCL( aVisibleRect ); - maGeometry.nX = static_cast<int>(aVisibleRect.origin.x + aVisibleRect.size.width / 10); - maGeometry.nY = static_cast<int>(aVisibleRect.origin.y + aVisibleRect.size.height / 10); - maGeometry.nWidth = static_cast<unsigned int>(aVisibleRect.size.width * 0.8); - maGeometry.nHeight = static_cast<unsigned int>(aVisibleRect.size.height * 0.8); + maGeometry.setX(static_cast<sal_Int32>(aVisibleRect.origin.x + aVisibleRect.size.width / 10)); + maGeometry.setY(static_cast<sal_Int32>(aVisibleRect.origin.y + aVisibleRect.size.height / 10)); + maGeometry.setWidth(static_cast<sal_uInt32>(aVisibleRect.size.width * 0.8)); + maGeometry.setHeight(static_cast<sal_uInt32>(aVisibleRect.size.height * 0.8)); // calculate style mask if( (mnStyle & SalFrameStyleFlags::FLOAT) || @@ -184,10 +184,10 @@ void AquaSalFrame::initWindowAndView() NSWindowStyleMaskResizable | NSWindowStyleMaskClosable; // make default window "maximized" - maGeometry.nX = static_cast<int>(aVisibleRect.origin.x); - maGeometry.nY = static_cast<int>(aVisibleRect.origin.y); - maGeometry.nWidth = static_cast<int>(aVisibleRect.size.width); - maGeometry.nHeight = static_cast<int>(aVisibleRect.size.height); + maGeometry.setX(static_cast<sal_Int32>(aVisibleRect.origin.x)); + maGeometry.setY(static_cast<sal_Int32>(aVisibleRect.origin.y)); + maGeometry.setWidth(static_cast<sal_uInt32>(aVisibleRect.size.width)); + maGeometry.setHeight(static_cast<sal_uInt32>(aVisibleRect.size.height)); mbPositioned = mbSized = true; } else @@ -231,7 +231,7 @@ void AquaSalFrame::initWindowAndView() [mpNSWindow setDelegate: static_cast<id<NSWindowDelegate> >(mpNSWindow)]; [mpNSWindow setRestorable:NO]; - const NSRect aRect = { NSZeroPoint, NSMakeSize( maGeometry.nWidth, maGeometry.nHeight )}; + const NSRect aRect = { NSZeroPoint, NSMakeSize(maGeometry.width(), maGeometry.height()) }; mnTrackingRectTag = [mpNSView addTrackingRect: aRect owner: mpNSView userData: nil assumeInside: NO]; maSysData.mpNSView = mpNSView; @@ -246,7 +246,7 @@ void AquaSalFrame::CocoaToVCL( NSRect& io_rRect, bool bRelativeToScreen ) if( bRelativeToScreen ) io_rRect.origin.y = maScreenRect.size.height - (io_rRect.origin.y+io_rRect.size.height); else - io_rRect.origin.y = maGeometry.nHeight - (io_rRect.origin.y+io_rRect.size.height); + io_rRect.origin.y = maGeometry.height() - (io_rRect.origin.y+io_rRect.size.height); } void AquaSalFrame::VCLToCocoa( NSRect& io_rRect, bool bRelativeToScreen ) @@ -254,7 +254,7 @@ void AquaSalFrame::VCLToCocoa( NSRect& io_rRect, bool bRelativeToScreen ) if( bRelativeToScreen ) io_rRect.origin.y = maScreenRect.size.height - (io_rRect.origin.y+io_rRect.size.height); else - io_rRect.origin.y = maGeometry.nHeight - (io_rRect.origin.y+io_rRect.size.height); + io_rRect.origin.y = maGeometry.height() - (io_rRect.origin.y+io_rRect.size.height); } void AquaSalFrame::CocoaToVCL( NSPoint& io_rPoint, bool bRelativeToScreen ) @@ -262,7 +262,7 @@ void AquaSalFrame::CocoaToVCL( NSPoint& io_rPoint, bool bRelativeToScreen ) if( bRelativeToScreen ) io_rPoint.y = maScreenRect.size.height - io_rPoint.y; else - io_rPoint.y = maGeometry.nHeight - io_rPoint.y; + io_rPoint.y = maGeometry.height() - io_rPoint.y; } void AquaSalFrame::VCLToCocoa( NSPoint& io_rPoint, bool bRelativeToScreen ) @@ -270,7 +270,7 @@ void AquaSalFrame::VCLToCocoa( NSPoint& io_rPoint, bool bRelativeToScreen ) if( bRelativeToScreen ) io_rPoint.y = maScreenRect.size.height - io_rPoint.y; else - io_rPoint.y = maGeometry.nHeight - io_rPoint.y; + io_rPoint.y = maGeometry.height() - io_rPoint.y; } void AquaSalFrame::screenParametersChanged() @@ -393,25 +393,25 @@ void AquaSalFrame::initShow() if( mpParent ) // center relative to parent { // center on parent - tools::Long nNewX = mpParent->maGeometry.nX + (static_cast<tools::Long>(mpParent->maGeometry.nWidth) - static_cast<tools::Long>(maGeometry.nWidth))/2; + tools::Long nNewX = mpParent->maGeometry.x() + (static_cast<tools::Long>(mpParent->maGeometry.width()) - static_cast<tools::Long>(maGeometry.width())) / 2; if( nNewX < aScreenRect.Left() ) nNewX = aScreenRect.Left(); - if( tools::Long(nNewX + maGeometry.nWidth) > aScreenRect.Right() ) - nNewX = aScreenRect.Right() - maGeometry.nWidth-1; - tools::Long nNewY = mpParent->maGeometry.nY + (static_cast<tools::Long>(mpParent->maGeometry.nHeight) - static_cast<tools::Long>(maGeometry.nHeight))/2; + if (static_cast<tools::Long>(nNewX + maGeometry.width()) > aScreenRect.Right()) + nNewX = aScreenRect.Right() - maGeometry.width() - 1; + tools::Long nNewY = mpParent->maGeometry.y() + (static_cast<tools::Long>(mpParent->maGeometry.height()) - static_cast<tools::Long>(maGeometry.height())) / 2; if( nNewY < aScreenRect.Top() ) nNewY = aScreenRect.Top(); if( nNewY > aScreenRect.Bottom() ) - nNewY = aScreenRect.Bottom() - maGeometry.nHeight-1; - SetPosSize( nNewX - mpParent->maGeometry.nX, - nNewY - mpParent->maGeometry.nY, + nNewY = aScreenRect.Bottom() - maGeometry.height() - 1; + SetPosSize( nNewX - mpParent->maGeometry.x(), + nNewY - mpParent->maGeometry.y(), 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); } else if( ! (mnStyle & SalFrameStyleFlags::SIZEABLE) ) { // center on screen - tools::Long nNewX = (aScreenRect.GetWidth() - maGeometry.nWidth)/2; - tools::Long nNewY = (aScreenRect.GetHeight() - maGeometry.nHeight)/2; + tools::Long nNewX = (aScreenRect.GetWidth() - maGeometry.width()) / 2; + tools::Long nNewY = (aScreenRect.GetHeight() - maGeometry.height()) / 2; SetPosSize( nNewX, nNewY, 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); } } @@ -424,7 +424,7 @@ void AquaSalFrame::SendPaintEvent( const tools::Rectangle* pRect ) { OSX_SALDATA_RUNINMAIN( SendPaintEvent( pRect ) ) - SalPaintEvent aPaintEvt( 0, 0, maGeometry.nWidth, maGeometry.nHeight, true ); + SalPaintEvent aPaintEvt(0, 0, maGeometry.width(), maGeometry.height(), true); if( pRect ) { aPaintEvt.mnBoundX = pRect->Left(); @@ -507,8 +507,8 @@ void AquaSalFrame::SetMinClientSize( tools::Long nWidth, tools::Long nHeight ) { // Always add the decoration as the dimension concerns only // the content rectangle - nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration; - nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration; + nWidth += maGeometry.leftDecoration() + maGeometry.rightDecoration(); + nHeight += maGeometry.topDecoration() + maGeometry.bottomDecoration(); NSSize aSize = { static_cast<CGFloat>(nWidth), static_cast<CGFloat>(nHeight) }; @@ -529,8 +529,8 @@ void AquaSalFrame::SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) { // Always add the decoration as the dimension concerns only // the content rectangle - nWidth += maGeometry.nLeftDecoration + maGeometry.nRightDecoration; - nHeight += maGeometry.nTopDecoration + maGeometry.nBottomDecoration; + nWidth += maGeometry.leftDecoration() + maGeometry.rightDecoration(); + nHeight += maGeometry.topDecoration() + maGeometry.bottomDecoration(); // Carbon windows can't have a size greater than 32767x32767 if (nWidth>32767) nWidth=32767; @@ -548,8 +548,8 @@ void AquaSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) { if (mbShown || mbInitShow || Application::IsBitmapRendering()) { - rWidth = maGeometry.nWidth; - rHeight = maGeometry.nHeight; + rWidth = maGeometry.width(); + rHeight = maGeometry.height(); } else { @@ -578,24 +578,24 @@ SalEvent AquaSalFrame::PreparePosSize(tools::Long nX, tools::Long nY, tools::Lon if (Application::IsBitmapRendering()) { if (nFlags & SAL_FRAME_POSSIZE_X) - maGeometry.nX = nX; + maGeometry.setX(nX); if (nFlags & SAL_FRAME_POSSIZE_Y) - maGeometry.nY = nY; + maGeometry.setY(nY); if (nFlags & SAL_FRAME_POSSIZE_WIDTH) { - maGeometry.nWidth = nWidth; - if (mnMaxWidth > 0 && maGeometry.nWidth > o3tl::make_unsigned(mnMaxWidth)) - maGeometry.nWidth = mnMaxWidth; - if (mnMinWidth > 0 && maGeometry.nWidth < o3tl::make_unsigned(mnMinWidth)) - maGeometry.nWidth = mnMinWidth; + maGeometry.setWidth(nWidth); + if (mnMaxWidth > 0 && maGeometry.width() > mnMaxWidth) + maGeometry.setWidth(mnMaxWidth); + if (mnMinWidth > 0 && maGeometry.width() < mnMinWidth) + maGeometry.setWidth(mnMinWidth); } if (nFlags & SAL_FRAME_POSSIZE_HEIGHT) { - maGeometry.nHeight = nHeight; - if (mnMaxHeight > 0 && maGeometry.nHeight > o3tl::make_unsigned(mnMaxHeight)) - maGeometry.nHeight = mnMaxHeight; - if (mnMinHeight > 0 && maGeometry.nHeight < o3tl::make_unsigned(mnMinHeight)) - maGeometry.nHeight = mnMinHeight; + maGeometry.setHeight(nHeight); + if (mnMaxHeight > 0 && maGeometry.height() > mnMaxHeight) + maGeometry.setHeight(mnMaxHeight); + if (mnMinHeight > 0 && maGeometry.height() < mnMinHeight) + maGeometry.setHeight(mnMinHeight); } if (nEvent != SalEvent::NONE) CallCallback(nEvent, nullptr); @@ -604,7 +604,7 @@ SalEvent AquaSalFrame::PreparePosSize(tools::Long nX, tools::Long nY, tools::Lon return nEvent; } -void AquaSalFrame::SetWindowState( const SalFrameState* pState ) +void AquaSalFrame::SetWindowState(const vcl::WindowData* pState) { if (!mpNSWindow && !Application::IsBitmapRendering()) return; @@ -612,12 +612,12 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) OSX_SALDATA_RUNINMAIN( SetWindowState( pState ) ) sal_uInt16 nFlags = 0; - nFlags |= ((pState->mnMask & WindowStateMask::X) ? SAL_FRAME_POSSIZE_X : 0); - nFlags |= ((pState->mnMask & WindowStateMask::Y) ? SAL_FRAME_POSSIZE_Y : 0); - nFlags |= ((pState->mnMask & WindowStateMask::Width) ? SAL_FRAME_POSSIZE_WIDTH : 0); - nFlags |= ((pState->mnMask & WindowStateMask::Height) ? SAL_FRAME_POSSIZE_HEIGHT : 0); + nFlags |= ((pState->mask() & vcl::WindowDataMask::X) ? SAL_FRAME_POSSIZE_X : 0); + nFlags |= ((pState->mask() & vcl::WindowDataMask::Y) ? SAL_FRAME_POSSIZE_Y : 0); + nFlags |= ((pState->mask() & vcl::WindowDataMask::Width) ? SAL_FRAME_POSSIZE_WIDTH : 0); + nFlags |= ((pState->mask() & vcl::WindowDataMask::Height) ? SAL_FRAME_POSSIZE_HEIGHT : 0); - SalEvent nEvent = PreparePosSize(pState->mnX, pState->mnY, pState->mnWidth, pState->mnHeight, nFlags); + SalEvent nEvent = PreparePosSize(pState->x(), pState->y(), pState->width(), pState->height(), nFlags); if (Application::IsBitmapRendering()) return; @@ -625,19 +625,19 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) NSRect aStateRect = [mpNSWindow frame]; aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask]; CocoaToVCL(aStateRect); - if (pState->mnMask & WindowStateMask::X) - aStateRect.origin.x = float(pState->mnX); - if (pState->mnMask & WindowStateMask::Y) - aStateRect.origin.y = float(pState->mnY); - if (pState->mnMask & WindowStateMask::Width) - aStateRect.size.width = float(pState->mnWidth); - if (pState->mnMask & WindowStateMask::Height) - aStateRect.size.height = float(pState->mnHeight); + if (pState->mask() & vcl::WindowDataMask::X) + aStateRect.origin.x = float(pState->x()); + if (pState->mask() & vcl::WindowDataMask::Y) + aStateRect.origin.y = float(pState->y()); + if (pState->mask() & vcl::WindowDataMask::Width) + aStateRect.size.width = float(pState->width()); + if (pState->mask() & vcl::WindowDataMask::Height) + aStateRect.size.height = float(pState->height()); VCLToCocoa(aStateRect); aStateRect = [NSWindow frameRectForContentRect: aStateRect styleMask: mnStyleMask]; [mpNSWindow setFrame: aStateRect display: NO]; - if (pState->mnState == WindowStateState::Minimized) + if (pState->state() == vcl::WindowState::Minimized) [mpNSWindow miniaturize: NSApp]; else if ([mpNSWindow isMiniaturized]) [mpNSWindow deminiaturize: NSApp]; @@ -646,7 +646,7 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) the program specified one), but comes closest since the default behavior is "maximized" if the user did not intervene */ - if (pState->mnState == WindowStateState::Maximized) + if (pState->state() == vcl::WindowState::Maximized) { if (![mpNSWindow isZoomed]) [mpNSWindow zoom: NSApp]; @@ -674,20 +674,15 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState ) } } -bool AquaSalFrame::GetWindowState( SalFrameState* pState ) +bool AquaSalFrame::GetWindowState(vcl::WindowData* pState) { if (!mpNSWindow) { if (Application::IsBitmapRendering()) { - pState->mnMask = WindowStateMask::X | WindowStateMask::Y - | WindowStateMask::Width | WindowStateMask::Height - | WindowStateMask::State; - pState->mnX = maGeometry.nX; - pState->mnY = maGeometry.nY; - pState->mnWidth = maGeometry.nWidth; - pState->mnHeight = maGeometry.nHeight; - pState->mnState = WindowStateState::Normal; + pState->setMask(vcl::WindowDataMask::PosSizeState); + pState->setPosSize(maGeometry.posSize()); + pState->setState(vcl::WindowState::Normal); return true; } return false; @@ -695,26 +690,22 @@ bool AquaSalFrame::GetWindowState( SalFrameState* pState ) OSX_SALDATA_RUNINMAIN_UNION( GetWindowState( pState ), boolean ) - pState->mnMask = WindowStateMask::X | - WindowStateMask::Y | - WindowStateMask::Width | - WindowStateMask::Height | - WindowStateMask::State; + pState->setMask(vcl::WindowDataMask::PosSizeState); NSRect aStateRect = [mpNSWindow frame]; aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask]; CocoaToVCL( aStateRect ); - pState->mnX = tools::Long(aStateRect.origin.x); - pState->mnY = tools::Long(aStateRect.origin.y); - pState->mnWidth = tools::Long(aStateRect.size.width); - pState->mnHeight = tools::Long(aStateRect.size.height); + pState->setX(static_cast<sal_Int32>(aStateRect.origin.x)); + pState->setY(static_cast<sal_Int32>(aStateRect.origin.y)); + pState->setWidth(static_cast<sal_uInt32>(aStateRect.size.width)); + pState->setHeight(static_cast<sal_uInt32>(aStateRect.size.height)); if( [mpNSWindow isMiniaturized] ) - pState->mnState = WindowStateState::Minimized; + pState->setState(vcl::WindowState::Minimized); else if( ! [mpNSWindow isZoomed] ) - pState->mnState = WindowStateState::Normal; + pState->setState(vcl::WindowState::Normal); else - pState->mnState = WindowStateState::Maximized; + pState->setState(vcl::WindowState::Maximized); return true; } @@ -961,7 +952,7 @@ void AquaSalFrame::SetPointerPos( tools::Long nX, tools::Long nY ) // FIXME: use Cocoa functions // FIXME: multiscreen support - CGPoint aPoint = { static_cast<CGFloat>(nX + maGeometry.nX), static_cast<CGFloat>(nY + maGeometry.nY) }; + CGPoint aPoint = { static_cast<CGFloat>(nX + maGeometry.x()), static_cast<CGFloat>(nY + maGeometry.y()) }; CGDirectDisplayID mainDisplayID = CGMainDisplayID(); CGDisplayMoveCursorToPoint( mainDisplayID, aPoint ); } @@ -1392,9 +1383,9 @@ void AquaSalFrame::SetPosSize( if( AllSettings::GetLayoutRTL() ) { if( (nFlags & SAL_FRAME_POSSIZE_WIDTH) != 0 ) - nX = mpParent->maGeometry.nWidth - nWidth-1 - nX; + nX = static_cast<tools::Long>(mpParent->maGeometry.width()) - nWidth - 1 - nX; else - nX = mpParent->maGeometry.nWidth - static_cast<tools::Long>( aContentRect.size.width-1) - nX; + nX = static_cast<tools::Long>(mpParent->maGeometry.width()) - aContentRect.size.width - 1 - nX; } NSRect aParentFrameRect = [mpParent->mpNSWindow frame]; aParentContentRect = [NSWindow contentRectForFrameRect: aParentFrameRect styleMask: mpParent->mnStyleMask]; @@ -1669,10 +1660,10 @@ void AquaSalFrame::UpdateFrameGeometry() if( pScreens ) { unsigned int nNewDisplayScreenNumber = [pScreens indexOfObject: pScreen]; - if (bFirstTime || maGeometry.nDisplayScreenNumber != nNewDisplayScreenNumber) + if (bFirstTime || maGeometry.screen() != nNewDisplayScreenNumber) { mbGeometryDidChange = true; - maGeometry.nDisplayScreenNumber = nNewDisplayScreenNumber; + maGeometry.setScreen(nNewDisplayScreenNumber); } } } @@ -1704,19 +1695,17 @@ void AquaSalFrame::UpdateFrameGeometry() maContentRect = aContentRect; maFrameRect = aFrameRect; - maGeometry.nX = static_cast<int>(aContentRect.origin.x); - maGeometry.nY = static_cast<int>(aContentRect.origin.y); - - maGeometry.nLeftDecoration = static_cast<unsigned int>(aContentRect.origin.x - aFrameRect.origin.x); - maGeometry.nRightDecoration = static_cast<unsigned int>((aFrameRect.origin.x + aFrameRect.size.width) - - (aContentRect.origin.x + aContentRect.size.width)); - - maGeometry.nTopDecoration = static_cast<unsigned int>(aContentRect.origin.y - aFrameRect.origin.y); - maGeometry.nBottomDecoration = static_cast<unsigned int>((aFrameRect.origin.y + aFrameRect.size.height) - - (aContentRect.origin.y + aContentRect.size.height)); - - maGeometry.nWidth = static_cast<unsigned int>(aContentRect.size.width); - maGeometry.nHeight = static_cast<unsigned int>(aContentRect.size.height); + maGeometry.setX(static_cast<sal_Int32>(aContentRect.origin.x)); + maGeometry.setY(static_cast<sal_Int32>(aContentRect.origin.y)); + maGeometry.setWidth(static_cast<sal_uInt32>(aContentRect.size.width)); + maGeometry.setHeight(static_cast<sal_uInt32>(aContentRect.size.height)); + + maGeometry.setLeftDecoration(static_cast<sal_uInt32>(aContentRect.origin.x - aFrameRect.origin.x)); + maGeometry.setRightDecoration(static_cast<sal_uInt32>((aFrameRect.origin.x + aFrameRect.size.width) - + (aContentRect.origin.x + aContentRect.size.width))); + maGeometry.setTopDecoration(static_cast<sal_uInt32>(aContentRect.origin.y - aFrameRect.origin.y)); + maGeometry.setBottomDecoration(static_cast<sal_uInt32>((aFrameRect.origin.y + aFrameRect.size.height) - + (aContentRect.origin.y + aContentRect.size.height))); } } diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index ee245af64820..df2c55abf97a 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -166,8 +166,8 @@ static AquaSalFrame* getMouseContainerFrame() { mDraggingDestinationHandler = nil; mpFrame = pFrame; - NSRect aRect = { { static_cast<CGFloat>(pFrame->maGeometry.nX), static_cast<CGFloat>(pFrame->maGeometry.nY) }, - { static_cast<CGFloat>(pFrame->maGeometry.nWidth), static_cast<CGFloat>(pFrame->maGeometry.nHeight) } }; + 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()) } }; pFrame->VCLToCocoa( aRect ); NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() @@ -473,7 +473,7 @@ static AquaSalFrame* getMouseContainerFrame() if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) { // FIXME: does this leak the returned NSCursor of getCurrentCursor ? - const NSRect aRect = { NSZeroPoint, NSMakeSize( mpFrame->maGeometry.nWidth, mpFrame->maGeometry.nHeight) }; + const NSRect aRect = { NSZeroPoint, NSMakeSize(mpFrame->maGeometry.width(), mpFrame->maGeometry.height()) }; [self addCursorRect: aRect cursor: mpFrame->getCurrentCursor()]; } } @@ -600,13 +600,13 @@ static AquaSalFrame* getMouseContainerFrame() SalMouseEvent aEvent; aEvent.mnTime = pDispatchFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - pDispatchFrame->maGeometry.nX; - aEvent.mnY = static_cast<tools::Long>(aPt.y) - pDispatchFrame->maGeometry.nY; + aEvent.mnX = static_cast<tools::Long>(aPt.x) - pDispatchFrame->maGeometry.x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - pDispatchFrame->maGeometry.y(); aEvent.mnButton = nButton; aEvent.mnCode = aEvent.mnButton | nModMask; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = pDispatchFrame->maGeometry.nWidth-1-aEvent.mnX; + aEvent.mnX = pDispatchFrame->maGeometry.width() - 1 - aEvent.mnX; pDispatchFrame->CallCallback( nEvent, &aEvent ); } @@ -760,14 +760,14 @@ static AquaSalFrame* getMouseContainerFrame() SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.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.nWidth-1-aEvent.mnX; + aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; aEvent.mnDelta = nDeltaZ; aEvent.mnNotchDelta = (nDeltaZ >= 0) ? +1 : -1; @@ -817,13 +817,13 @@ static AquaSalFrame* getMouseContainerFrame() SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mbDeltaIsPixel = true; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX; + aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; if( dX != 0.0 ) { @@ -876,13 +876,13 @@ static AquaSalFrame* getMouseContainerFrame() SalWheelMouseEvent aEvent; aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnX = static_cast<tools::Long>(aPt.x) - mpFrame->maGeometry.x(); + aEvent.mnY = static_cast<tools::Long>(aPt.y) - mpFrame->maGeometry.y(); aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); aEvent.mbDeltaIsPixel = false; if( AllSettings::GetLayoutRTL() ) - aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX; + aEvent.mnX = mpFrame->maGeometry.width() - 1 - aEvent.mnX; if( dX != 0.0 ) { @@ -1666,8 +1666,8 @@ static AquaSalFrame* getMouseContainerFrame() NSRect rect; - rect.origin.x = aPosEvent.mnX + mpFrame->maGeometry.nX; - rect.origin.y = aPosEvent.mnY + mpFrame->maGeometry.nY + 4; // add some space for underlines + rect.origin.x = aPosEvent.mnX + mpFrame->maGeometry.x(); + rect.origin.y = aPosEvent.mnY + mpFrame->maGeometry.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 7b088864d111..603a8b612d42 100644 --- a/vcl/osx/salgdiutils.cxx +++ b/vcl/osx/salgdiutils.cxx @@ -148,8 +148,8 @@ bool AquaSharedAttributes::checkContext() { if (mbWindow && mpFrame && (mpFrame->getNSWindow() || Application::IsBitmapRendering())) { - const unsigned int nWidth = mpFrame->maGeometry.nWidth; - const unsigned int nHeight = mpFrame->maGeometry.nHeight; + const unsigned int nWidth = mpFrame->maGeometry.width(); + const unsigned int nHeight = mpFrame->maGeometry.height(); const float fScale = sal::aqua::getWindowScaling(); CGLayerRef rReleaseLayer = nullptr; diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index ab6263cc84a7..c35e7487f0f6 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -302,8 +302,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.nX - pParentAquaSalFrame->maGeometry.nX + offset; - displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.nY - pParentAquaSalFrame->maGeometry.nY + offset; + displayPopupFrame.origin.x = pWin->ImplGetFrame()->maGeometry.x() - pParentAquaSalFrame->maGeometry.x() + offset; + displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.y() - pParentAquaSalFrame->maGeometry.y() + offset; pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false); // #i111992# if this menu was opened due to a key event, prevent dispatching that yet again @@ -819,8 +819,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.nX; - aRect.origin.y -= i_pReferenceFrame->maGeometry.nY + aRect.size.height; + aRect.origin.x -= i_pReferenceFrame->maGeometry.x(); + aRect.origin.y -= i_pReferenceFrame->maGeometry.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 328cf9c94eca..3cd368b92a81 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -866,11 +866,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.nHeight - 3) + if (rc.origin.y + rc.size.height >= mpFrame->maGeometry.height() - 3) { CGMutablePathRef rPath = CGPathCreateMutable(); CGPathAddRect(rPath, nullptr, - CGRectMake(0, 0, mpFrame->maGeometry.nWidth - 1, mpFrame->maGeometry.nHeight - 1)); + CGRectMake(0, 0, mpFrame->maGeometry.width() - 1, mpFrame->maGeometry.height() - 1)); CGContextBeginPath(context); CGContextAddPath(context, rPath); CGContextClip(context); |