• Ken Thomases's avatar
    XQuartz: Fix how we calculate the height of the OSX menu bar · 4513f924
    Ken Thomases authored
    +[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: default avatarJeremy Huddleston Sequoia <jeremyhu@apple.com>
    Signed-off-by: default avatarKen Thomases <ken@codeweavers.com>
    4513f924
Name
Last commit
Last update
Xext Loading commit data...
Xi Loading commit data...
composite Loading commit data...
config Loading commit data...
damageext Loading commit data...
dbe Loading commit data...
dix Loading commit data...
doc Loading commit data...
dri3 Loading commit data...
exa Loading commit data...
fb Loading commit data...
glamor Loading commit data...
glx Loading commit data...
hw Loading commit data...
include Loading commit data...
m4 Loading commit data...
man Loading commit data...
mi Loading commit data...
miext Loading commit data...
os Loading commit data...
present Loading commit data...
pseudoramiX Loading commit data...
randr Loading commit data...
record Loading commit data...
render Loading commit data...
test Loading commit data...
xfixes Loading commit data...
xkb Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
COPYING Loading commit data...
Makefile.am Loading commit data...
README Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
devbook.am Loading commit data...
docbook.am Loading commit data...
fix-miregion Loading commit data...
fix-miregion-private Loading commit data...
fix-patch-whitespace Loading commit data...
fix-region Loading commit data...
manpages.am Loading commit data...
xorg-server.m4 Loading commit data...
xorg-server.pc.in Loading commit data...
xserver.ent.in Loading commit data...