vcl/unx/generic/window/salframe.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
New commits: commit 1dea71cbaa04a68aa496a146bb71a690aed0f88d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Jan 28 15:41:52 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Jan 28 18:05:30 2022 +0100 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 <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> 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(),