diff options
| author | Jan Djärv | 2012-09-30 14:50:09 +0200 |
|---|---|---|
| committer | Jan Djärv | 2012-09-30 14:50:09 +0200 |
| commit | dd946752ab8810149a66a3eff469eb128709972d (patch) | |
| tree | c5eed47769e004b457ed6ad377f48e4789b8a2ae /src | |
| parent | ee41332bd8a529ee7ce96b4d19d350f6fcc5248c (diff) | |
| download | emacs-dd946752ab8810149a66a3eff469eb128709972d.tar.gz emacs-dd946752ab8810149a66a3eff469eb128709972d.zip | |
Add support for fullscreen in the NS port.
* etc/NEWS: The NS port supports fullscreen.
* src/nsfns.m (ns_frame_parm_handlers): Add x_set_fullscreen.
* src/nsterm.h (MAC_OS_X_VERSION_10_7, MAC_OS_X_VERSION_10_8): New.
(EmacsView): Add variables for fullscreen.
(handleFS, setFSValue, toggleFullScreen): New in EmacsView.
(EmacsFSWindow): New interface for fullscreen.
* src/nsterm.m (NEW_STYLE_FS): New define.
(ns_fullscreen_hook, windowWillEnterFullScreen)
(windowDidEnterFullScreen, windowWillExitFullScreen)
(windowDidExitFullScreen, toggleFullScreen, handleFS)
(setFSValue): New functions.
(EmacsFSWindow): New implementation.
(canBecomeKeyWindow): New function for EmacsFSWindow.
(ns_create_terminal): Set fullscreen_hook to ns_fullscreen_hook.
(dealloc): Release nonfs_window if in fullscreen.
(updateFrameSize:): Call windowDidMove to update top/left.
(windowWillResize:toSize:): Check if frame is still maximized.
(initFrameFromEmacs:): Initialize fs_state, fs_before_fs,
next_maximized, maximized_width, maximized_height and nonfs_window.
Call setCollectionBehavior if NEW_STYLE_FS. Initialize bwidth and
tbar_height.
(windowWillUseStandardFrame:defaultFrame:): Update frame parameter
fullscreen. Set maximized_width/height. Act on next_maximized.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 27 | ||||
| -rw-r--r-- | src/nsfns.m | 2 | ||||
| -rw-r--r-- | src/nsterm.h | 18 | ||||
| -rw-r--r-- | src/nsterm.m | 296 |
4 files changed, 327 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1f240b219e0..6aaa6bc88f8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,30 @@ | |||
| 1 | 2012-09-30 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsfns.m (ns_frame_parm_handlers): Add x_set_fullscreen. | ||
| 4 | |||
| 5 | * nsterm.m (NEW_STYLE_FS): New define. | ||
| 6 | (ns_fullscreen_hook, windowWillEnterFullScreen) | ||
| 7 | (windowDidEnterFullScreen, windowWillExitFullScreen) | ||
| 8 | (windowDidExitFullScreen, toggleFullScreen, handleFS) | ||
| 9 | (setFSValue): New functions. | ||
| 10 | (EmacsFSWindow): New implementation. | ||
| 11 | (canBecomeKeyWindow): New function for EmacsFSWindow. | ||
| 12 | (ns_create_terminal): Set fullscreen_hook to ns_fullscreen_hook. | ||
| 13 | (dealloc): Release nonfs_window if in fullscreen. | ||
| 14 | (updateFrameSize:): Call windowDidMove to update top/left. | ||
| 15 | (windowWillResize:toSize:): Check if frame is still maximized. | ||
| 16 | (initFrameFromEmacs:): Initialize fs_state, fs_before_fs, | ||
| 17 | next_maximized, maximized_width, maximized_height and nonfs_window. | ||
| 18 | Call setCollectionBehavior if NEW_STYLE_FS. Initialize bwidth and | ||
| 19 | tbar_height. | ||
| 20 | (windowWillUseStandardFrame:defaultFrame:): Update frame parameter | ||
| 21 | fullscreen. Set maximized_width/height. Act on next_maximized. | ||
| 22 | |||
| 23 | * nsterm.h (MAC_OS_X_VERSION_10_7, MAC_OS_X_VERSION_10_8): New. | ||
| 24 | (EmacsView): Add variables for fullscreen. | ||
| 25 | (handleFS, setFSValue, toggleFullScreen): New in EmacsView. | ||
| 26 | (EmacsFSWindow): New interface for fullscreen. | ||
| 27 | |||
| 1 | 2012-09-30 Juanma Barranquero <lekktu@gmail.com> | 28 | 2012-09-30 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 29 | ||
| 3 | * makefile.w32-in ($(BLD)/profiler.$(O)): Update dependencies. | 30 | * makefile.w32-in ($(BLD)/profiler.$(O)): Update dependencies. |
diff --git a/src/nsfns.m b/src/nsfns.m index 94ace360438..c96ec99ed2e 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -1018,7 +1018,7 @@ frame_parm_handler ns_frame_parm_handlers[] = | |||
| 1018 | x_set_fringe_width, /* generic OK */ | 1018 | x_set_fringe_width, /* generic OK */ |
| 1019 | x_set_fringe_width, /* generic OK */ | 1019 | x_set_fringe_width, /* generic OK */ |
| 1020 | 0, /* x_set_wait_for_wm, will ignore */ | 1020 | 0, /* x_set_wait_for_wm, will ignore */ |
| 1021 | 0, /* x_set_fullscreen will ignore */ | 1021 | x_set_fullscreen, /* generic OK */ |
| 1022 | x_set_font_backend, /* generic OK */ | 1022 | x_set_font_backend, /* generic OK */ |
| 1023 | x_set_alpha, | 1023 | x_set_alpha, |
| 1024 | 0, /* x_set_sticky */ | 1024 | 0, /* x_set_sticky */ |
diff --git a/src/nsterm.h b/src/nsterm.h index 97fc6be20e5..f06e0cb0f7f 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -38,6 +38,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 38 | #ifndef MAC_OS_X_VERSION_10_6 | 38 | #ifndef MAC_OS_X_VERSION_10_6 |
| 39 | #define MAC_OS_X_VERSION_10_6 1060 | 39 | #define MAC_OS_X_VERSION_10_6 1060 |
| 40 | #endif | 40 | #endif |
| 41 | #ifndef MAC_OS_X_VERSION_10_7 | ||
| 42 | #define MAC_OS_X_VERSION_10_7 1070 | ||
| 43 | #endif | ||
| 44 | #ifndef MAC_OS_X_VERSION_10_8 | ||
| 45 | #define MAC_OS_X_VERSION_10_8 1080 | ||
| 46 | #endif | ||
| 41 | #endif /* NS_IMPL_COCOA */ | 47 | #endif /* NS_IMPL_COCOA */ |
| 42 | 48 | ||
| 43 | #ifdef __OBJC__ | 49 | #ifdef __OBJC__ |
| @@ -80,6 +86,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 80 | BOOL windowClosing; | 86 | BOOL windowClosing; |
| 81 | NSString *workingText; | 87 | NSString *workingText; |
| 82 | BOOL processingCompose; | 88 | BOOL processingCompose; |
| 89 | int fs_state, fs_before_fs, next_maximized, tbar_height, bwidth; | ||
| 90 | int maximized_width, maximized_height; | ||
| 91 | NSWindow *nonfs_window; | ||
| 83 | @public | 92 | @public |
| 84 | struct frame *emacsframe; | 93 | struct frame *emacsframe; |
| 85 | int rows, cols; | 94 | int rows, cols; |
| @@ -104,6 +113,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 104 | - (EmacsToolbar *) toolbar; | 113 | - (EmacsToolbar *) toolbar; |
| 105 | - (void) deleteWorkingText; | 114 | - (void) deleteWorkingText; |
| 106 | - (void) updateFrameSize: (BOOL) delay; | 115 | - (void) updateFrameSize: (BOOL) delay; |
| 116 | - (void) handleFS; | ||
| 117 | - (void) setFSValue: (int)value; | ||
| 118 | - (void) toggleFullScreen: (id) sender; | ||
| 107 | 119 | ||
| 108 | #ifdef NS_IMPL_GNUSTEP | 120 | #ifdef NS_IMPL_GNUSTEP |
| 109 | /* Not declared, but useful. */ | 121 | /* Not declared, but useful. */ |
| @@ -120,6 +132,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 120 | @end | 132 | @end |
| 121 | 133 | ||
| 122 | 134 | ||
| 135 | /* Fullscreen version of the above. */ | ||
| 136 | @interface EmacsFSWindow : EmacsWindow | ||
| 137 | { | ||
| 138 | } | ||
| 139 | @end | ||
| 140 | |||
| 123 | /* ========================================================================== | 141 | /* ========================================================================== |
| 124 | 142 | ||
| 125 | The main menu implementation | 143 | The main menu implementation |
diff --git a/src/nsterm.m b/src/nsterm.m index 5af3c2e2ae1..d41c38f4e40 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -72,6 +72,11 @@ int term_trace_num = 0; | |||
| 72 | #define NSTRACE(x) | 72 | #define NSTRACE(x) |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #if defined (NS_IMPL_COCOA) && \ | ||
| 76 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 | ||
| 77 | #define NEW_STYLE_FS | ||
| 78 | #endif | ||
| 79 | |||
| 75 | extern NSString *NSMenuDidBeginTrackingNotification; | 80 | extern NSString *NSMenuDidBeginTrackingNotification; |
| 76 | 81 | ||
| 77 | /* ========================================================================== | 82 | /* ========================================================================== |
| @@ -1306,6 +1311,17 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) | |||
| 1306 | } | 1311 | } |
| 1307 | 1312 | ||
| 1308 | 1313 | ||
| 1314 | static void | ||
| 1315 | ns_fullscreen_hook (FRAME_PTR f) | ||
| 1316 | { | ||
| 1317 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | ||
| 1318 | |||
| 1319 | if (! f->async_visible) return; | ||
| 1320 | |||
| 1321 | block_input (); | ||
| 1322 | [view handleFS]; | ||
| 1323 | unblock_input (); | ||
| 1324 | } | ||
| 1309 | 1325 | ||
| 1310 | /* ========================================================================== | 1326 | /* ========================================================================== |
| 1311 | 1327 | ||
| @@ -3932,7 +3948,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo) | |||
| 3932 | terminal->frame_rehighlight_hook = ns_frame_rehighlight; | 3948 | terminal->frame_rehighlight_hook = ns_frame_rehighlight; |
| 3933 | terminal->frame_raise_lower_hook = ns_frame_raise_lower; | 3949 | terminal->frame_raise_lower_hook = ns_frame_raise_lower; |
| 3934 | 3950 | ||
| 3935 | terminal->fullscreen_hook = 0; /* see XTfullscreen_hook */ | 3951 | terminal->fullscreen_hook = ns_fullscreen_hook; |
| 3936 | 3952 | ||
| 3937 | terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; | 3953 | terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; |
| 3938 | terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; | 3954 | terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; |
| @@ -4687,6 +4703,8 @@ not_in_argv (NSString *arg) | |||
| 4687 | { | 4703 | { |
| 4688 | NSTRACE (EmacsView_dealloc); | 4704 | NSTRACE (EmacsView_dealloc); |
| 4689 | [toolbar release]; | 4705 | [toolbar release]; |
| 4706 | if (fs_state == FULLSCREEN_BOTH) | ||
| 4707 | [nonfs_window release]; | ||
| 4690 | [super dealloc]; | 4708 | [super dealloc]; |
| 4691 | } | 4709 | } |
| 4692 | 4710 | ||
| @@ -5405,6 +5423,7 @@ not_in_argv (NSString *arg) | |||
| 5405 | SET_FRAME_GARBAGED (emacsframe); | 5423 | SET_FRAME_GARBAGED (emacsframe); |
| 5406 | cancel_mouse_face (emacsframe); | 5424 | cancel_mouse_face (emacsframe); |
| 5407 | [view setFrame: NSMakeRect (0, 0, neww, newh)]; | 5425 | [view setFrame: NSMakeRect (0, 0, neww, newh)]; |
| 5426 | [self windowDidMove:nil]; // Update top/left. | ||
| 5408 | } | 5427 | } |
| 5409 | } | 5428 | } |
| 5410 | 5429 | ||
| @@ -5414,6 +5433,19 @@ not_in_argv (NSString *arg) | |||
| 5414 | NSTRACE (windowWillResize); | 5433 | NSTRACE (windowWillResize); |
| 5415 | /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ | 5434 | /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ |
| 5416 | 5435 | ||
| 5436 | if (fs_state == FULLSCREEN_MAXIMIZED | ||
| 5437 | && (maximized_width != (int)frameSize.width | ||
| 5438 | || maximized_height != (int)frameSize.height)) | ||
| 5439 | [self setFSValue: FULLSCREEN_NONE]; | ||
| 5440 | else if (fs_state == FULLSCREEN_WIDTH | ||
| 5441 | && maximized_width != (int)frameSize.width) | ||
| 5442 | [self setFSValue: FULLSCREEN_NONE]; | ||
| 5443 | else if (fs_state == FULLSCREEN_HEIGHT | ||
| 5444 | && maximized_height != (int)frameSize.height) | ||
| 5445 | [self setFSValue: FULLSCREEN_NONE]; | ||
| 5446 | if (fs_state == FULLSCREEN_NONE) | ||
| 5447 | maximized_width = maximized_height = -1; | ||
| 5448 | |||
| 5417 | cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, | 5449 | cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, |
| 5418 | #ifdef NS_IMPL_GNUSTEP | 5450 | #ifdef NS_IMPL_GNUSTEP |
| 5419 | frameSize.width + 3); | 5451 | frameSize.width + 3); |
| @@ -5595,6 +5627,10 @@ not_in_argv (NSString *arg) | |||
| 5595 | windowClosing = NO; | 5627 | windowClosing = NO; |
| 5596 | processingCompose = NO; | 5628 | processingCompose = NO; |
| 5597 | scrollbarsNeedingUpdate = 0; | 5629 | scrollbarsNeedingUpdate = 0; |
| 5630 | fs_state = FULLSCREEN_NONE; | ||
| 5631 | fs_before_fs = next_maximized = -1; | ||
| 5632 | maximized_width = maximized_height = -1; | ||
| 5633 | nonfs_window = nil; | ||
| 5598 | 5634 | ||
| 5599 | /*fprintf (stderr,"init with %d, %d\n",f->text_cols, f->text_lines); */ | 5635 | /*fprintf (stderr,"init with %d, %d\n",f->text_cols, f->text_lines); */ |
| 5600 | 5636 | ||
| @@ -5619,9 +5655,13 @@ not_in_argv (NSString *arg) | |||
| 5619 | backing: NSBackingStoreBuffered | 5655 | backing: NSBackingStoreBuffered |
| 5620 | defer: YES]; | 5656 | defer: YES]; |
| 5621 | 5657 | ||
| 5658 | #ifdef NEW_STYLE_FS | ||
| 5659 | [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; | ||
| 5660 | #endif | ||
| 5661 | |||
| 5622 | wr = [win frame]; | 5662 | wr = [win frame]; |
| 5623 | f->border_width = wr.size.width - r.size.width; | 5663 | bwidth = f->border_width = wr.size.width - r.size.width; |
| 5624 | FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height; | 5664 | tbar_height = FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height; |
| 5625 | 5665 | ||
| 5626 | [win setAcceptsMouseMovedEvents: YES]; | 5666 | [win setAcceptsMouseMovedEvents: YES]; |
| 5627 | [win setDelegate: self]; | 5667 | [win setDelegate: self]; |
| @@ -5727,27 +5767,50 @@ not_in_argv (NSString *arg) | |||
| 5727 | 5767 | ||
| 5728 | NSTRACE (windowWillUseStandardFrame); | 5768 | NSTRACE (windowWillUseStandardFrame); |
| 5729 | 5769 | ||
| 5730 | if (abs (defaultFrame.size.height - result.size.height) | 5770 | if (fs_before_fs != -1) /* Entering fullscreen */ |
| 5731 | > FRAME_LINE_HEIGHT (emacsframe)) | 5771 | { |
| 5772 | result = defaultFrame; | ||
| 5773 | } | ||
| 5774 | else if (next_maximized == FULLSCREEN_HEIGHT | ||
| 5775 | || (next_maximized == -1 | ||
| 5776 | && abs (defaultFrame.size.height - result.size.height) | ||
| 5777 | > FRAME_LINE_HEIGHT (emacsframe))) | ||
| 5732 | { | 5778 | { |
| 5733 | /* first click */ | 5779 | /* first click */ |
| 5734 | ns_userRect = result; | 5780 | ns_userRect = result; |
| 5735 | result.size.height = defaultFrame.size.height; | 5781 | maximized_height = result.size.height = defaultFrame.size.height; |
| 5782 | maximized_width = -1; | ||
| 5736 | result.origin.y = defaultFrame.origin.y; | 5783 | result.origin.y = defaultFrame.origin.y; |
| 5784 | [self setFSValue: FULLSCREEN_HEIGHT]; | ||
| 5785 | } | ||
| 5786 | else if (next_maximized == FULLSCREEN_WIDTH) | ||
| 5787 | { | ||
| 5788 | ns_userRect = result; | ||
| 5789 | maximized_width = result.size.width = defaultFrame.size.width; | ||
| 5790 | maximized_height = -1; | ||
| 5791 | result.origin.x = defaultFrame.origin.x; | ||
| 5792 | [self setFSValue: FULLSCREEN_WIDTH]; | ||
| 5793 | } | ||
| 5794 | else if (next_maximized == FULLSCREEN_MAXIMIZED | ||
| 5795 | || (next_maximized == -1 | ||
| 5796 | && abs (defaultFrame.size.width - result.size.width) | ||
| 5797 | > FRAME_COLUMN_WIDTH (emacsframe))) | ||
| 5798 | { | ||
| 5799 | result = defaultFrame; /* second click */ | ||
| 5800 | maximized_width = result.size.width; | ||
| 5801 | maximized_height = result.size.height; | ||
| 5802 | [self setFSValue: FULLSCREEN_MAXIMIZED]; | ||
| 5737 | } | 5803 | } |
| 5738 | else | 5804 | else |
| 5739 | { | 5805 | { |
| 5740 | if (abs (defaultFrame.size.width - result.size.width) | 5806 | /* restore */ |
| 5741 | > FRAME_COLUMN_WIDTH (emacsframe)) | 5807 | result = ns_userRect.size.height ? ns_userRect : result; |
| 5742 | result = defaultFrame; /* second click */ | 5808 | ns_userRect = NSMakeRect (0, 0, 0, 0); |
| 5743 | else | 5809 | [self setFSValue: FULLSCREEN_NONE]; |
| 5744 | { | 5810 | maximized_width = maximized_width = -1; |
| 5745 | /* restore */ | ||
| 5746 | result = ns_userRect.size.height ? ns_userRect : result; | ||
| 5747 | ns_userRect = NSMakeRect (0, 0, 0, 0); | ||
| 5748 | } | ||
| 5749 | } | 5811 | } |
| 5750 | 5812 | ||
| 5813 | if (fs_before_fs == -1) next_maximized = -1; | ||
| 5751 | [self windowWillResize: sender toSize: result.size]; | 5814 | [self windowWillResize: sender toSize: result.size]; |
| 5752 | return result; | 5815 | return result; |
| 5753 | } | 5816 | } |
| @@ -5799,6 +5862,200 @@ not_in_argv (NSString *arg) | |||
| 5799 | } | 5862 | } |
| 5800 | } | 5863 | } |
| 5801 | 5864 | ||
| 5865 | - (void)windowWillEnterFullScreen:(NSNotification *)notification | ||
| 5866 | { | ||
| 5867 | fs_before_fs = fs_state; | ||
| 5868 | } | ||
| 5869 | |||
| 5870 | - (void)windowDidEnterFullScreen:(NSNotification *)notification | ||
| 5871 | { | ||
| 5872 | [self setFSValue: FULLSCREEN_BOTH]; | ||
| 5873 | #ifndef NEW_STYLE_FS | ||
| 5874 | fprintf(stderr, "%s %d\n", __func__, FRAME_PIXEL_WIDTH (emacsframe)); | ||
| 5875 | [self windowDidBecomeKey:notification]; | ||
| 5876 | #endif | ||
| 5877 | } | ||
| 5878 | |||
| 5879 | - (void)windowWillExitFullScreen:(NSNotification *)notification | ||
| 5880 | { | ||
| 5881 | if (next_maximized != -1) | ||
| 5882 | fs_before_fs = next_maximized; | ||
| 5883 | } | ||
| 5884 | |||
| 5885 | - (void)windowDidExitFullScreen:(NSNotification *)notification | ||
| 5886 | { | ||
| 5887 | [self setFSValue: fs_before_fs]; | ||
| 5888 | fs_before_fs = -1; | ||
| 5889 | if (next_maximized != -1) | ||
| 5890 | [[self window] performZoom:self]; | ||
| 5891 | } | ||
| 5892 | |||
| 5893 | - (void)toggleFullScreen: (id)sender | ||
| 5894 | { | ||
| 5895 | /* Bugs remain: | ||
| 5896 | 1) Having fullscreen in initial/default frame alist. | ||
| 5897 | 2) Fullscreen in default frame alist only applied to first frame. | ||
| 5898 | */ | ||
| 5899 | |||
| 5900 | #ifdef NEW_STYLE_FS | ||
| 5901 | [[self window] toggleFullScreen:sender]; | ||
| 5902 | #else | ||
| 5903 | NSWindow *w = [self window], *fw; | ||
| 5904 | BOOL onFirstScreen = [[w screen] | ||
| 5905 | isEqual:[[NSScreen screens] objectAtIndex:0]]; | ||
| 5906 | struct frame *f = emacsframe; | ||
| 5907 | NSSize sz; | ||
| 5908 | NSRect r; | ||
| 5909 | NSColor *col = ns_lookup_indexed_color (NS_FACE_BACKGROUND | ||
| 5910 | (FRAME_DEFAULT_FACE (f)), | ||
| 5911 | f); | ||
| 5912 | |||
| 5913 | sz.width = FRAME_COLUMN_WIDTH (f); | ||
| 5914 | sz.height = FRAME_LINE_HEIGHT (f); | ||
| 5915 | |||
| 5916 | if (fs_state != FULLSCREEN_BOTH) | ||
| 5917 | { | ||
| 5918 | /* Hide dock and menubar if we are on the primary screen. */ | ||
| 5919 | if (onFirstScreen) | ||
| 5920 | { | ||
| 5921 | #if defined (NS_IMPL_COCOA) && \ | ||
| 5922 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | ||
| 5923 | NSApplicationPresentationOptions options | ||
| 5924 | = NSApplicationPresentationAutoHideDock | ||
| 5925 | | NSApplicationPresentationAutoHideMenuBar; | ||
| 5926 | |||
| 5927 | [NSApp setPresentationOptions: options]; | ||
| 5928 | #else | ||
| 5929 | [NSMenu setMenuBarVisible:NO]; | ||
| 5930 | #endif | ||
| 5931 | } | ||
| 5932 | |||
| 5933 | fw = [[EmacsFSWindow alloc] | ||
| 5934 | initWithContentRect:[w contentRectForFrameRect:[w frame]] | ||
| 5935 | styleMask:NSBorderlessWindowMask | ||
| 5936 | backing:NSBackingStoreBuffered | ||
| 5937 | defer:YES | ||
| 5938 | screen:[w screen]]; | ||
| 5939 | |||
| 5940 | [fw setContentView:[w contentView]]; | ||
| 5941 | [fw setTitle:[w title]]; | ||
| 5942 | [fw makeKeyAndOrderFront:NSApp]; | ||
| 5943 | [fw setDelegate:self]; | ||
| 5944 | [fw makeFirstResponder:self]; | ||
| 5945 | [fw setAcceptsMouseMovedEvents: YES]; | ||
| 5946 | [fw useOptimizedDrawing: YES]; | ||
| 5947 | [fw setResizeIncrements: sz]; | ||
| 5948 | [fw setBackgroundColor: col]; | ||
| 5949 | if ([col alphaComponent] != 1.0) | ||
| 5950 | [fw setOpaque: NO]; | ||
| 5951 | |||
| 5952 | f->border_width = 0; | ||
| 5953 | FRAME_NS_TITLEBAR_HEIGHT (f) = 0; | ||
| 5954 | |||
| 5955 | nonfs_window = w; | ||
| 5956 | [self windowWillEnterFullScreen:nil]; | ||
| 5957 | [w orderOut:self]; | ||
| 5958 | r = [fw frameRectForContentRect:[[fw screen] frame]]; | ||
| 5959 | [fw setFrame: r display:YES animate:YES]; | ||
| 5960 | [self windowDidEnterFullScreen:nil]; | ||
| 5961 | } | ||
| 5962 | else | ||
| 5963 | { | ||
| 5964 | fw = w; | ||
| 5965 | w = nonfs_window; | ||
| 5966 | |||
| 5967 | if (onFirstScreen) | ||
| 5968 | { | ||
| 5969 | #if defined (NS_IMPL_COCOA) && \ | ||
| 5970 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | ||
| 5971 | [NSApp setPresentationOptions: NSApplicationPresentationDefault]; | ||
| 5972 | #else | ||
| 5973 | [NSMenu setMenuBarVisible:YES]; | ||
| 5974 | #endif | ||
| 5975 | } | ||
| 5976 | |||
| 5977 | [w setContentView:[fw contentView]]; | ||
| 5978 | [w setResizeIncrements: sz]; | ||
| 5979 | [w setBackgroundColor: col]; | ||
| 5980 | if ([col alphaComponent] != 1.0) | ||
| 5981 | [w setOpaque: NO]; | ||
| 5982 | |||
| 5983 | f->border_width = bwidth; | ||
| 5984 | FRAME_NS_TITLEBAR_HEIGHT (f) = tbar_height; | ||
| 5985 | |||
| 5986 | [self windowWillExitFullScreen:nil]; | ||
| 5987 | [fw setFrame: [w frame] display:YES animate:YES]; | ||
| 5988 | [fw close]; | ||
| 5989 | [w makeKeyAndOrderFront:NSApp]; | ||
| 5990 | [self windowDidExitFullScreen:nil]; | ||
| 5991 | } | ||
| 5992 | #endif | ||
| 5993 | } | ||
| 5994 | |||
| 5995 | - (void)handleFS | ||
| 5996 | { | ||
| 5997 | if (fs_state != emacsframe->want_fullscreen) | ||
| 5998 | { | ||
| 5999 | if (fs_state == FULLSCREEN_BOTH) | ||
| 6000 | { | ||
| 6001 | [self toggleFullScreen:self]; | ||
| 6002 | } | ||
| 6003 | |||
| 6004 | switch (emacsframe->want_fullscreen) | ||
| 6005 | { | ||
| 6006 | case FULLSCREEN_BOTH: | ||
| 6007 | [self toggleFullScreen:self]; | ||
| 6008 | break; | ||
| 6009 | case FULLSCREEN_WIDTH: | ||
| 6010 | next_maximized = FULLSCREEN_WIDTH; | ||
| 6011 | if (fs_state != FULLSCREEN_BOTH) | ||
| 6012 | [[self window] performZoom:self]; | ||
| 6013 | break; | ||
| 6014 | case FULLSCREEN_HEIGHT: | ||
| 6015 | next_maximized = FULLSCREEN_HEIGHT; | ||
| 6016 | if (fs_state != FULLSCREEN_BOTH) | ||
| 6017 | [[self window] performZoom:self]; | ||
| 6018 | break; | ||
| 6019 | case FULLSCREEN_MAXIMIZED: | ||
| 6020 | next_maximized = FULLSCREEN_MAXIMIZED; | ||
| 6021 | if (fs_state != FULLSCREEN_BOTH) | ||
| 6022 | [[self window] performZoom:self]; | ||
| 6023 | break; | ||
| 6024 | case FULLSCREEN_NONE: | ||
| 6025 | if (fs_state != FULLSCREEN_BOTH) | ||
| 6026 | { | ||
| 6027 | next_maximized = FULLSCREEN_NONE; | ||
| 6028 | [[self window] performZoom:self]; | ||
| 6029 | } | ||
| 6030 | break; | ||
| 6031 | } | ||
| 6032 | |||
| 6033 | emacsframe->want_fullscreen = FULLSCREEN_NONE; | ||
| 6034 | } | ||
| 6035 | |||
| 6036 | } | ||
| 6037 | |||
| 6038 | - (void) setFSValue: (int)value | ||
| 6039 | { | ||
| 6040 | Lisp_Object lval = Qnil; | ||
| 6041 | switch (value) | ||
| 6042 | { | ||
| 6043 | case FULLSCREEN_BOTH: | ||
| 6044 | lval = Qfullboth; | ||
| 6045 | break; | ||
| 6046 | case FULLSCREEN_WIDTH: | ||
| 6047 | lval = Qfullwidth; | ||
| 6048 | break; | ||
| 6049 | case FULLSCREEN_HEIGHT: | ||
| 6050 | lval = Qfullheight; | ||
| 6051 | break; | ||
| 6052 | case FULLSCREEN_MAXIMIZED: | ||
| 6053 | lval = Qmaximized; | ||
| 6054 | break; | ||
| 6055 | } | ||
| 6056 | store_frame_param (emacsframe, Qfullscreen, lval); | ||
| 6057 | fs_state = value; | ||
| 6058 | } | ||
| 5802 | 6059 | ||
| 5803 | - (void)mouseEntered: (NSEvent *)theEvent | 6060 | - (void)mouseEntered: (NSEvent *)theEvent |
| 5804 | { | 6061 | { |
| @@ -6290,6 +6547,15 @@ not_in_argv (NSString *arg) | |||
| 6290 | @end /* EmacsWindow */ | 6547 | @end /* EmacsWindow */ |
| 6291 | 6548 | ||
| 6292 | 6549 | ||
| 6550 | @implementation EmacsFSWindow | ||
| 6551 | |||
| 6552 | - (BOOL)canBecomeKeyWindow | ||
| 6553 | { | ||
| 6554 | return YES; | ||
| 6555 | } | ||
| 6556 | |||
| 6557 | @end | ||
| 6558 | |||
| 6293 | /* ========================================================================== | 6559 | /* ========================================================================== |
| 6294 | 6560 | ||
| 6295 | EmacsScroller implementation | 6561 | EmacsScroller implementation |