Screen frames and fullscreen windows

Christiaan Hofman cmhofman at gmail.com
Thu Aug 16 06:57:08 PDT 2007


I am struggling at the moment with properly placing fullscreen  
windows on arbitrary screens. In particular when the fullscreen  
window is not on the primary screen, the fullscreen window sometimes  
gets offset, and I've no idea what causes this. I use [screen frame]  
for the frame of the fullscreen window and place some secondary  
windows relative to this frame. But they sometimes seem to get offset  
relative to the primary screen.

First of all, I need to understand the coordinates that are used for  
windows and screens. Unfortunately the docs are vague and  
inconsistent on this point, so I'm not sure if my interpretation is  
correct. They mention in several place "screen coordinates". E.g.  
window frames and content frames and screen frames are relative to  
this. My main question is : what are screen coordinates (as this is  
not defined anywhere in the docs).

I can think of two distinct interpretations:

1. relative to the lower right corner of the primary screen
2. relative to the lower right corner of the current screen (the one  
that is referred to).

I've made 1 my working hypothesis. But it is inconsistent with what  
the docs say about the window's contentRect (which implies 2 should  
be correct). However 2 seems utterly useless to me as you would not  
be able to refer to the frame of any screen in an unambiguous manner  
(it always has origin NSZeroPoint relative to itself) and would make  
it impossible to move windows to another screen.

And how are different resolutions oif the different screens taken  
into account in the screen coordinates? I've no idea, frankly.

It would be helpful is someone could enlighten me a bit.

Thanks,

Christiaan



More information about the MacOSX-dev mailing list