diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-01-28 15:41:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-01-28 18:05:30 +0100 |
commit | 1dea71cbaa04a68aa496a146bb71a690aed0f88d (patch) | |
tree | 86144fd77f371b70523e3c7c36e287a09fb18649 /vcl | |
parent | a4348ec796e6efe0edce7bb8bfa47b1fa95d0e34 (diff) |
Related: tdf#146261 the intent it to keep the dialog within the screen
not the parent allocation
Change-Id: I1801fca14e864e4e18c0b42d7f3c3956e71f8e23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129115
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 70803c7353e4..4b1a00e2eed3 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -1725,15 +1725,20 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState ) } } + auto nRight = aPosSize.Right() + (mpParent ? mpParent->maGeometry.nX : 0); + auto nBottom = aPosSize.Bottom() + (mpParent ? mpParent->maGeometry.nY : 0); + auto nLeft = aPosSize.Left() + (mpParent ? mpParent->maGeometry.nX : 0); + auto nTop = aPosSize.Top() + (mpParent ? mpParent->maGeometry.nY : 0); + // adjust position so that frame fits onto screen - if( aPosSize.Right()+static_cast<tools::Long>(aGeom.nRightDecoration) > aScreenSize.Width()-1 ) - aPosSize.Move( aScreenSize.Width() - aPosSize.Right() - static_cast<tools::Long>(aGeom.nRightDecoration), 0 ); - if( aPosSize.Bottom()+static_cast<tools::Long>(aGeom.nBottomDecoration) > aScreenSize.Height()-1 ) - aPosSize.Move( 0, aScreenSize.Height() - aPosSize.Bottom() - static_cast<tools::Long>(aGeom.nBottomDecoration) ); - if( aPosSize.Left() < static_cast<tools::Long>(aGeom.nLeftDecoration) ) - aPosSize.Move( static_cast<tools::Long>(aGeom.nLeftDecoration) - aPosSize.Left(), 0 ); - if( aPosSize.Top() < static_cast<tools::Long>(aGeom.nTopDecoration) ) - aPosSize.Move( 0, static_cast<tools::Long>(aGeom.nTopDecoration) - aPosSize.Top() ); + if( nRight+static_cast<tools::Long>(aGeom.nRightDecoration) > aScreenSize.Width()-1 ) + aPosSize.Move( aScreenSize.Width() - nRight - static_cast<tools::Long>(aGeom.nRightDecoration), 0 ); + if( nBottom+static_cast<tools::Long>(aGeom.nBottomDecoration) > aScreenSize.Height()-1 ) + aPosSize.Move( 0, aScreenSize.Height() - nBottom - static_cast<tools::Long>(aGeom.nBottomDecoration) ); + if( nLeft < static_cast<tools::Long>(aGeom.nLeftDecoration) ) + aPosSize.Move( static_cast<tools::Long>(aGeom.nLeftDecoration) - nLeft, 0 ); + if( nTop < static_cast<tools::Long>(aGeom.nTopDecoration) ) + aPosSize.Move( 0, static_cast<tools::Long>(aGeom.nTopDecoration) - nTop ); } SetPosSize(aPosSize.getX(), aPosSize.getY(), |