From 0c2aec0e8fc79337dd56840d834c4cbc083c01c0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 7 Mar 2007 19:51:00 +0000 Subject: [PATCH] return correct client area for at least the primary display, fixes the problems with incorrect positioning of the Center()d windows [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/mac/carbon/display.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index d38ba37e83..5bf14a3cff 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -116,6 +116,7 @@ wxMac - Added support for the wxFRAME_FLOAT_ON_PARENT style. - Now takes window variants into account when rendering buttons. +- Fix position of the centered windows (didn't take menu bar size into account) wxX11: diff --git a/src/mac/carbon/display.cpp b/src/mac/carbon/display.cpp index a69b111ae8..3e9d8d50a1 100644 --- a/src/mac/carbon/display.cpp +++ b/src/mac/carbon/display.cpp @@ -63,6 +63,7 @@ public: } virtual wxRect GetGeometry() const; + virtual wxRect GetClientArea() const; virtual wxString GetName() const { return wxString(); } virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const; @@ -173,6 +174,17 @@ wxRect wxDisplayImplMacOSX::GetGeometry() const (int)theRect.size.height ); //floats } +wxRect wxDisplayImplMacOSX::GetClientArea() const +{ + // VZ: I don't know how to get client area for arbitrary display but + // wxGetClientDisplayRect() does work correctly for at least the main + // one (TODO: do it correctly for the other displays too) + if ( IsPrimary() ) + return wxGetClientDisplayRect(); + + return wxDisplayImpl::GetClientArea(); +} + static int wxCFDictKeyToInt( CFDictionaryRef desc, CFStringRef key ) { CFNumberRef value = (CFNumberRef) CFDictionaryGetValue( desc, key );