Hi!
I think this is a good start. However, there is a case that your patch miss. If you have multiple monitors arranged in, say, an L-shape, a frame might be placed inside "multiscreenRect", without actually being visible on any screen. (This typically occur when you have a large desktop monitor connected to a laptop or when you have one monitor placed horizontally and one vertically.)
Fortunately, it should be easy to fix. What about something like (in pseudo-code):
BOOL in_any_screen = NO;
for (screen = /* Loop over all screens */ ...)
{
if (overlapping(frame, scree))
{
in_any_screen = YES;
break;
}
}
if ( ! in_any_screen )
{
/* Move the frame in */
}
Anyway, I think that we're on the right track and I appreciate that you have taken time to work on this!
-- Anders
PS. I just found another, unrelated, problem, when comparing the NS and X11 versions. When passing a negative value to `set-frame-position' it is supposed to place the frame relative to the right/bottom border of the display, but in the NS version it doesn't. (The X11 version gets the Y placement wrong with 48 pixels, but that is another story.)