From: Vadim Zeitlin Date: Sat, 17 May 2008 12:56:18 +0000 (+0000) Subject: fix window rectangle computation in Centre(wxCENTER_ON_SCREEN) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/75454d243d4193dddf46b15741a021ce7f1f9a53 fix window rectangle computation in Centre(wxCENTER_ON_SCREEN) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index bcfd529105..a24634f669 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -273,8 +273,11 @@ void wxTopLevelWindowBase::DoCentre(int dir) if((rectParent == rectDisplay) && IsMaximized()) return; + if ( !(dir & wxBOTH) ) + dir |= wxBOTH; // if neither is specified, center in both directions + // the new window rect candidate - wxRect rect = GetRect().CentreIn(rectParent, dir); + wxRect rect = GetRect().CentreIn(rectParent, dir & ~wxCENTRE_ON_SCREEN); // we don't want to place the window off screen if Centre() is called as // this is (almost?) never wanted and it would be very difficult to prevent