diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index f75a9fe2be8..c22c5a70baa 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -8040,7 +8040,40 @@ not_in_argv (NSString *arg) | |||
| 8040 | NSTRACE_RETURN_RECT (frameRect); | 8040 | NSTRACE_RETURN_RECT (frameRect); |
| 8041 | return frameRect; | 8041 | return frameRect; |
| 8042 | } | 8042 | } |
| 8043 | #endif | 8043 | else |
| 8044 | #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 */ | ||
| 8045 | // Check that the proposed frameRect is visible in at least one | ||
| 8046 | // screen. If it is not, ask the system to reposition it (only | ||
| 8047 | // for non-child windows). | ||
| 8048 | |||
| 8049 | if (!FRAME_PARENT_FRAME (((EmacsView *)[self delegate])->emacsframe)) | ||
| 8050 | { | ||
| 8051 | NSArray *screens = [NSScreen screens]; | ||
| 8052 | NSUInteger nr_screens = [screens count]; | ||
| 8053 | |||
| 8054 | int i; | ||
| 8055 | BOOL frame_on_screen = NO; | ||
| 8056 | |||
| 8057 | for (i = 0; i < nr_screens; ++i) | ||
| 8058 | { | ||
| 8059 | NSScreen *s = [screens objectAtIndex: i]; | ||
| 8060 | NSRect scrRect = [s frame]; | ||
| 8061 | |||
| 8062 | if (NSIntersectsRect(frameRect, scrRect)) | ||
| 8063 | { | ||
| 8064 | frame_on_screen = YES; | ||
| 8065 | break; | ||
| 8066 | } | ||
| 8067 | } | ||
| 8068 | |||
| 8069 | if (!frame_on_screen) | ||
| 8070 | { | ||
| 8071 | NSTRACE_MSG ("Frame outside screens; constraining"); | ||
| 8072 | frameRect = [super constrainFrameRect:frameRect toScreen:screen]; | ||
| 8073 | NSTRACE_RETURN_RECT (frameRect); | ||
| 8074 | return frameRect; | ||
| 8075 | } | ||
| 8076 | } | ||
| 8044 | #endif | 8077 | #endif |
| 8045 | 8078 | ||
| 8046 | return constrain_frame_rect(frameRect, | 8079 | return constrain_frame_rect(frameRect, |