xserver/hw
Ken Thomases 52506f60b6 XQuartz: Fix how we calculate the height of the OSX menu bar
+[NSScreen mainScreen] does not mean the primary display.  It used to mean the
one with the key window.  When "Displays have separate spaces" is enabled, it
means the active screen, the one whose menu bar is mostly opaque.  As such, it
may not be the screen whose lower-left corner is located at (0, 0).  That's
why its max-Y is not necessarily comparable to its height.  That only works
for the primary display.

This code could use [[NSScreen screens] firstObject].  This is always the
primary display, the one whose lower-left corner is at (0, 0).

Once that's done, the above change should be reverted.  The height of the
visible frame would be the full height of the screen minus the menu bar _and
the Dock_ if the Dock is along the bottom of the screen.

Actually, there's a theoretically-simpler approach: use
-[NSMenu menuBarHeight].  That replaces a long-deprecated method
+[NSMenuView menuBarHeight].  However, there was a bug in Tiger that led to
the former not working while the latter still worked. I haven't actually
checked recently.

CrossOver's still-kicking X server code uses this code, which tries all of
the above:

       NSScreen* primaryScreen = [[NSScreen screens] objectAtIndex:0];
       aquaMenuBarHeight = [[NSApp mainMenu] menuBarHeight];
       if (!aquaMenuBarHeight) aquaMenuBarHeight = [NSMenuView menuBarHeight];
       if (!aquaMenuBarHeight) aquaMenuBarHeight =
           NSHeight([primaryScreen frame]) - NSMaxY([primaryScreen visibleFrame]);

Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
(cherry picked from commit 4513f924a7)
2015-10-14 00:36:58 -07:00
..
dmx dmx: include header for DMXExtensionInit() in dmx.c 2015-07-29 11:16:33 -04:00
kdrive Xephyr: Fix broken image when endianess of client machine and host-Xserver differ 2015-06-03 09:05:39 -04:00
vfb vfb: Don't reimplement micmap so much 2014-10-08 10:10:39 +02:00
xfree86 modesetting: Include dix-config.h from dumb_bo.c 2015-06-03 09:05:38 -04:00
xnest hw/xnest: Fix build for MinGW 2015-06-03 09:05:37 -04:00
xquartz XQuartz: Fix how we calculate the height of the OSX menu bar 2015-10-14 00:36:58 -07:00
xwayland xwayland: Throttle our cursor surface updates with a frame callback 2015-06-16 11:21:26 -04:00
xwin hw/xwin/winclipboard: Link xwinclip with -lpthread 2015-06-03 09:05:37 -04:00
Makefile.am Xwayland DDX 2014-04-03 15:19:22 -07:00