From b0e8363354f40e04796db447b56e39e9c61713f9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 17 May 2008 12:56:18 +0000 Subject: [PATCH] fix window rectangle computation in Centre(wxCENTER_ON_SCREEN) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/toplvcmn.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index a626791347..688b77710f 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -260,8 +260,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