[Xquartz-dev] Fix (?) for window positions when displays have separate Spaces

Tom Seddon xquartz-dev at tomseddon.plus.com
Thu Apr 30 14:18:09 PDT 2015


I've been having all sorts of problems with XQuartz and quartz-wm when 
the `Displays have separate Spaces' option is set. This seems to be due 
to the aquaBarMenuHeight calculation being a bit unusual - on my system 
it gets things hopelessly wrong, and decides the menu bar is -500 pixels 
high.

With my change (patch attached) it gets the right value, and windows are 
appropriately constrained to the screens' visible frames. Full screen 
mode still doesn't work, though.

Regards,

-- 
--Tom Seddon

P.S. I initially tried attacking this problem by editing quartz-wm. 
Something I noticed while doing this: when displays have separate 
spaces, the main screen is no longer fixed, meaning the result of 
[NSScreen mainScreen] isn't necessarily consistent.

But this doesn't happen to quartz-wm - it always gets the same result 
back from [NSScreen mainScreen], no matter what the true main screen. 
The reason for this, I found, was simply that it never creates an 
NSWindow. (I have no idea what the underlying reason for that is, and/or 
whether it's something you're supposed to be able to rely on.)

The calculations in x_screen actually seem to rely on the main screen 
always being the same, so if you "fix" it as I did, by creating a 
NSWindow object at some point, you get a whole second set of problems...
-------------- next part --------------
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2efbd65..a9ee693 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1240,7 +1240,7 @@ X11ApplicationMain(int argc, char **argv, char **envp)
 
     /* Calculate the height of the menubar so we can avoid it. */
     aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
-                        NSMaxY([[NSScreen mainScreen] visibleFrame]);
+                        NSHeight([[NSScreen mainScreen] visibleFrame]);
 
 #ifdef HAVE_LIBDISPATCH
     eventTranslationQueue = dispatch_queue_create(


More information about the Xquartz-dev mailing list