windows and display resolution changing


I've just about finished a nice little app except it has a few known issues that I'd like to fix. The main ones have to do with placement of the window onscreen.

My app uses a partially transparent window without any control bar at the top. It is at NSStatusWindowLevel so it goes above everything else. To move the window, you click on a solid part. The NSView subclass gets the mouse-down message and enters a loop in which it drags the window until it receives a mouse-up message.

1. Known bug: If I change display resolutions when the app is running, the window disappears (even if it should still be on screen). When I resize the window, using a slider in the Preferences, the window reappears but often in the wrong position. Then, clicking on the window brings the application to the foreground but no longer drags the window (so either the NSView isn't getting the mouse-down or the coordinates are confusing it). What do I need to do to get display resolution changes working without incident? (I've looked at the source code for NekoOnDesktop, which is fairly similar, and the code is very similar -- but the bug isn't there for Neko.)

2. Suspected bug: I don't have multiple monitors so I can't check this but I have a feeling that my app doesn't have multiple monitors support. :) How should I fix this? Just a line iterating through the screens, asking which of the screens my window is on? How do multiple monitors work? Is there a single coordinate system for all the screens? Should one be able to drag a window across different screens?