[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 6e0cac4: Constrain non-child frames to screen area
From: |
Alan Third |
Subject: |
[Emacs-diffs] master 6e0cac4: Constrain non-child frames to screen area in OS X |
Date: |
Tue, 2 May 2017 16:31:00 -0400 (EDT) |
branch: master
commit 6e0cac4896f70b28b2a608fd63bc88b0253313bf
Author: Charles A. Roelli <address@hidden>
Commit: Alan Third <address@hidden>
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
---
src/nsterm.m | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index f75a9fe..c22c5a7 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8040,7 +8040,40 @@ not_in_argv (NSString *arg)
NSTRACE_RETURN_RECT (frameRect);
return frameRect;
}
-#endif
+ else
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 */
+ // Check that the proposed frameRect is visible in at least one
+ // screen. If it is not, ask the system to reposition it (only
+ // for non-child windows).
+
+ if (!FRAME_PARENT_FRAME (((EmacsView *)[self delegate])->emacsframe))
+ {
+ NSArray *screens = [NSScreen screens];
+ NSUInteger nr_screens = [screens count];
+
+ int i;
+ BOOL frame_on_screen = NO;
+
+ for (i = 0; i < nr_screens; ++i)
+ {
+ NSScreen *s = [screens objectAtIndex: i];
+ NSRect scrRect = [s frame];
+
+ if (NSIntersectsRect(frameRect, scrRect))
+ {
+ frame_on_screen = YES;
+ break;
+ }
+ }
+
+ if (!frame_on_screen)
+ {
+ NSTRACE_MSG ("Frame outside screens; constraining");
+ frameRect = [super constrainFrameRect:frameRect toScreen:screen];
+ NSTRACE_RETURN_RECT (frameRect);
+ return frameRect;
+ }
+ }
#endif
return constrain_frame_rect(frameRect,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 6e0cac4: Constrain non-child frames to screen area in OS X,
Alan Third <=