diff options
| author | Jan Djärv | 2014-03-08 16:49:59 +0100 |
|---|---|---|
| committer | Jan Djärv | 2014-03-08 16:49:59 +0100 |
| commit | e61a31bf999b37f32616e5159196d179657ad788 (patch) | |
| tree | 57a9332a04ad8e3cbf3e295a5f2ef7282f59aee5 /src | |
| parent | 281ae1808d7b470e0aa11858ea0b3100d20d1694 (diff) | |
| download | emacs-e61a31bf999b37f32616e5159196d179657ad788.tar.gz emacs-e61a31bf999b37f32616e5159196d179657ad788.zip | |
* nsterm.h (MAC_OS_X_VERSION_10_9): Add.
* nsterm.m (constrainFrameRect:toScreen:): Constrain normally when frame
is only on one screen.
Fixes: debbugs:14713
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/nsterm.h | 3 | ||||
| -rw-r--r-- | src/nsterm.m | 28 |
3 files changed, 37 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 18f412362f1..5b75161f91c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-03-08 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.h (MAC_OS_X_VERSION_10_9): Add. | ||
| 4 | |||
| 5 | * nsterm.m (constrainFrameRect:toScreen:): Constrain normally when frame | ||
| 6 | is only on one screen (Bug#14713). | ||
| 7 | |||
| 1 | 2014-03-08 Eli Zaretskii <eliz@gnu.org> | 8 | 2014-03-08 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * xdisp.c (move_it_in_display_line_to): If word-wrap is ON, and | 10 | * xdisp.c (move_it_in_display_line_to): If word-wrap is ON, and |
diff --git a/src/nsterm.h b/src/nsterm.h index f058541027a..8e8a9b7f36f 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -42,6 +42,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 42 | #ifndef MAC_OS_X_VERSION_10_8 | 42 | #ifndef MAC_OS_X_VERSION_10_8 |
| 43 | #define MAC_OS_X_VERSION_10_8 1080 | 43 | #define MAC_OS_X_VERSION_10_8 1080 |
| 44 | #endif | 44 | #endif |
| 45 | #ifndef MAC_OS_X_VERSION_10_9 | ||
| 46 | #define MAC_OS_X_VERSION_10_9 1090 | ||
| 47 | #endif | ||
| 45 | 48 | ||
| 46 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 | 49 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 |
| 47 | #define HAVE_NATIVE_FS | 50 | #define HAVE_NATIVE_FS |
diff --git a/src/nsterm.m b/src/nsterm.m index b8dd8bc8ad2..0e8fc56fdd9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -6963,7 +6963,8 @@ if (cols > 0 && rows > 0) | |||
| 6963 | { | 6963 | { |
| 6964 | /* When making the frame visible for the first time or if there is just | 6964 | /* When making the frame visible for the first time or if there is just |
| 6965 | one screen, we want to constrain. Other times not. */ | 6965 | one screen, we want to constrain. Other times not. */ |
| 6966 | NSUInteger nr_screens = [[NSScreen screens] count]; | 6966 | NSArray *screens = [NSScreen screens]; |
| 6967 | NSUInteger nr_screens = [screens count], nr_eff_screens = 0, i; | ||
| 6967 | struct frame *f = ((EmacsView *)[self delegate])->emacsframe; | 6968 | struct frame *f = ((EmacsView *)[self delegate])->emacsframe; |
| 6968 | NSTRACE (constrainFrameRect); | 6969 | NSTRACE (constrainFrameRect); |
| 6969 | NSTRACE_RECT ("input", frameRect); | 6970 | NSTRACE_RECT ("input", frameRect); |
| @@ -6971,6 +6972,31 @@ if (cols > 0 && rows > 0) | |||
| 6971 | if (ns_menu_bar_should_be_hidden ()) | 6972 | if (ns_menu_bar_should_be_hidden ()) |
| 6972 | return frameRect; | 6973 | return frameRect; |
| 6973 | 6974 | ||
| 6975 | if (nr_screens == 1) | ||
| 6976 | return [super constrainFrameRect:frameRect toScreen:screen]; | ||
| 6977 | |||
| 6978 | #ifdef NS_IMPL_COCOA | ||
| 6979 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 | ||
| 6980 | // If separate spaces is on, it is like each screen is independent. There is | ||
| 6981 | // no spanning of frames across screens. | ||
| 6982 | if ([NSScreen screensHaveSeparateSpaces]) | ||
| 6983 | return [super constrainFrameRect:frameRect toScreen:screen]; | ||
| 6984 | #endif | ||
| 6985 | #endif | ||
| 6986 | |||
| 6987 | for (i = 0; i < nr_screens; ++i) | ||
| 6988 | { | ||
| 6989 | NSScreen *s = [screens objectAtIndex: i]; | ||
| 6990 | NSRect scrrect = [s frame]; | ||
| 6991 | NSRect intersect = NSIntersectionRect (frameRect, scrrect); | ||
| 6992 | |||
| 6993 | if (intersect.size.width > 0 || intersect.size.height > 0) | ||
| 6994 | ++nr_eff_screens; | ||
| 6995 | } | ||
| 6996 | |||
| 6997 | if (nr_eff_screens == 1) | ||
| 6998 | return [super constrainFrameRect:frameRect toScreen:screen]; | ||
| 6999 | |||
| 6974 | /* The default implementation does two things 1) ensure that the top | 7000 | /* The default implementation does two things 1) ensure that the top |
| 6975 | of the rectangle is below the menu bar (or below the top of the | 7001 | of the rectangle is below the menu bar (or below the top of the |
| 6976 | screen) and 2) resizes windows larger than the screen. As we | 7002 | screen) and 2) resizes windows larger than the screen. As we |