don't offset the window being centered more than strictly necessary for it to be on screen (replaces patch 1683239)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -231,7 +231,7 @@ void wxTopLevelWindowBase::DoCentre(int dir)
|
|||||||
|
|
||||||
if ( rectParent.IsEmpty() )
|
if ( rectParent.IsEmpty() )
|
||||||
{
|
{
|
||||||
// we were explicitely asked to centre this window on the entire screen
|
// we were explicitly asked to centre this window on the entire screen
|
||||||
// or if we have no parent anyhow and so can't centre on it
|
// or if we have no parent anyhow and so can't centre on it
|
||||||
rectParent = rectDisplay;
|
rectParent = rectDisplay;
|
||||||
}
|
}
|
||||||
@@ -250,11 +250,11 @@ void wxTopLevelWindowBase::DoCentre(int dir)
|
|||||||
{
|
{
|
||||||
if ( !rectDisplay.Contains(rect.GetBottomRight()) )
|
if ( !rectDisplay.Contains(rect.GetBottomRight()) )
|
||||||
{
|
{
|
||||||
// check if we can move the window so that the bottom right corner
|
// move the window just enough for the bottom right corner to
|
||||||
// is visible without hiding the top left one
|
// become visible
|
||||||
int dx = rectDisplay.GetRight() - rect.GetRight();
|
int dx = rectDisplay.GetRight() - rect.GetRight();
|
||||||
int dy = rectDisplay.GetBottom() - rect.GetBottom();
|
int dy = rectDisplay.GetBottom() - rect.GetBottom();
|
||||||
rect.Offset(dx, dy);
|
rect.Offset(dx < 0 ? dx : 0, dy < 0 ? dy : 0);
|
||||||
}
|
}
|
||||||
//else: the window top left and bottom right corner are both visible,
|
//else: the window top left and bottom right corner are both visible,
|
||||||
// although the window might still be not entirely on screen (with
|
// although the window might still be not entirely on screen (with
|
||||||
|
Reference in New Issue
Block a user