[wx-dev] Bug in default window positioning in wxMac 2.8 and later
Brett Bode
brett at ameslab.gov
Tue Mar 6 14:49:03 PST 2007
> On Thu, 15 Feb 2007 08:30:03 -0600 Brett Bode <brett at ameslab.gov>
> wrote:
>
> BB> It looks to me like the problem occurs in the
> BB> wxTopLevelWindowBase::DoCentre(int dir) function in the src/
> common/
> BB> toplvcmn.cpp file. In that function it tests against the display
> BB> boundaries defined as:
> BB>
> BB> const wxRect rectDisplay(dpy.GetClientArea());
> BB>
> BB> On a single display Mac that will return 0 for the top left
> corner.
> BB> However the menu bar occupies the top 20 or so pixels so the
> usable
> BB> area of the display is reduced. I have hacked up a workaround that
> BB> sets the top coordinate to 20 which works around the problem
> for me
> BB> for the moment, but I am sure that is not a preferred general fix.
>
> I don't know how to get the size of the menubar under Mac but I can
> confirm that wxDisplay::GetClientArea() should definitely account
> for it
> and it doesn't do it now which is certainly a bug. Stefan, if you
> have time
> to look at this, please add GetClientArea() implementation to
> wxDisplayImplMacOSX class. Otherwise any pointers to Mac API which
> allows
> to get the size of the client area (i.e. excluding the menubar)
> would be
> welcome.
>
> Thanks,
> VZ
While working on another problem I discovered that the global
wxGetClientDisplayRect()
function returns the correct display rectangle on the Mac including a
correct for the menu bar (sets the top value to 22). Thus the proper
logic for the menu bar correction is present in that function and
just needs to be patched into the wxDisplay::GetClientArea() function
properly.
Thanks!
Brett
More information about the wx-dev
mailing list