aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharles A. Roelli2017-04-27 20:44:09 +0200
committerAlan Third2017-05-02 21:28:42 +0100
commit6e0cac4896f70b28b2a608fd63bc88b0253313bf (patch)
treee95f69e219aee4277d8fd98cf01047fcb340503f /src
parentb50dda3fa2d21973cd87b537a746f5ed70bdc9af (diff)
downloademacs-6e0cac4896f70b28b2a608fd63bc88b0253313bf.tar.gz
emacs-6e0cac4896f70b28b2a608fd63bc88b0253313bf.zip
Constrain non-child frames to screen area in OS X
* src/nsterm.m (constrainFrameRect:toScreen:): Constrain non-child frames in OS X, if they would otherwise go offscreen. Fixes: debbugs:25818
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m35
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,