Last active
September 27, 2015 05:38
-
-
Save eikeon/1219862 to your computer and use it in GitHub Desktop.
Emacs 24.0 Lion Fullscreen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/nsterm.m b/src/nsterm.m | |
index a45792f..ee5a71b 100644 | |
--- a/src/nsterm.m | |
+++ b/src/nsterm.m | |
@@ -4393,6 +4393,9 @@ ns_term_shutdown (int sig) | |
{ | |
NSTRACE (applicationDidFinishLaunching); | |
[NSApp setServicesProvider: NSApp]; | |
+ | |
+ [NSApp setPresentationOptions:NSFullScreenWindowMask]; | |
+ | |
ns_send_appdefined (-2); | |
} | |
@@ -5282,6 +5285,7 @@ ns_term_shutdown (int sig) | |
/* normalize frame to gridded text size */ | |
{ | |
NSTRACE (windowWillResize); | |
+ | |
/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ | |
cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, | |
@@ -5500,6 +5504,9 @@ ns_term_shutdown (int sig) | |
backing: NSBackingStoreBuffered | |
defer: YES]; | |
+ [win setCollectionBehavior: | |
+ NSWindowCollectionBehaviorFullScreenPrimary]; | |
+ | |
wr = [win frame]; | |
f->border_width = wr.size.width - r.size.width; | |
FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height; | |
@@ -5587,6 +5594,40 @@ ns_term_shutdown (int sig) | |
} | |
} | |
+- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize | |
+{ | |
+ [window setToolbar: nil]; | |
+ return [[window screen] frame].size; | |
+} | |
+ | |
+- (void)windowDidExitFullScreen:(NSNotification *)notification | |
+{ | |
+ // | |
+} | |
+ | |
+- (void)windowDidEnterFullScreen:(NSNotification *)notification | |
+{ | |
+ NSWindow *window = [self window]; | |
+ | |
+ NSRect r = [window contentRectForFrameRect:[window frame]]; | |
+ NSSize size = r.size; | |
+ | |
+ int new_cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, size.width); | |
+ int new_rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, size.height); | |
+ | |
+ FRAME_PIXEL_WIDTH (emacsframe) = (int)size.width; | |
+ FRAME_PIXEL_HEIGHT (emacsframe) = (int)size.height; | |
+ | |
+ emacsframe->border_width = [window frame].size.width - size.width; | |
+ //emacsframe->top_pos = [[window screen] frame].size.height - (r.origin.y + r.size.height); | |
+ | |
+ FRAME_NS_TITLEBAR_HEIGHT (emacsframe) = [window frame].size.height - size.height; | |
+ | |
+ change_frame_size (emacsframe, new_rows, new_cols, 0, 1, 0); /* pretend, delay, safe */ | |
+ //x_set_window_size (emacsframe, 0, new_cols, new_rows); | |
+ [[window delegate] windowDidMove:nil]; | |
+} | |
+ | |
/* Called AFTER method below, but before our windowWillResize call there leads | |
to windowDidResize -> x_set_window_size. Update emacs' notion of frame | |
@@ -5604,6 +5645,12 @@ ns_term_shutdown (int sig) | |
- (NSRect)windowWillUseStandardFrame:(NSWindow *)sender | |
defaultFrame:(NSRect)defaultFrame | |
{ | |
+ | |
+ if (FRAME_EXTERNAL_TOOL_BAR (emacsframe)) { | |
+ [[self window] setToolbar: toolbar]; | |
+ [toolbar setVisible: YES]; | |
+ } | |
+ | |
NSRect result = [sender frame]; | |
NSTRACE (windowWillUseStandardFrame); |
Looks like fullscreen support has eventually made it upstream from somewhere. At least I just build emacs from source without this patch and the fullscreen support seems decent.
Not sure when it was introduced, but am now running:
GNU Emacs 24.3.50.1 (i386-apple-darwin12.2.0, NS apple-appkit-1187.34) of 2012-12-22 on gato.local
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aha, yes -- that behaves much better. I really hope a comprehensive patch gets into Emacs HEAD sooner or later; I picture a
'ns-use-native-fullscreen
var to choose whether or not to use Lion fullscreening, and then a version ofns-toggle-fullscreen
function which understands both full-screen methods, and anns-fullscreen-p
predicate. I'd buckle down and hack it together myself if I had any faith that a patch would be accepted upstream...-Steve