Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
MaxOSX Lion fullscreen patch for emacs 24.1
--- src/nsterm.m.orig 2012-06-14 01:05:10.000000000 +0900
+++ src/nsterm.m 2012-06-14 01:07:56.000000000 +0900
@@ -5507,6 +5507,7 @@
[win setAcceptsMouseMovedEvents: YES];
[win setDelegate: self];
[win useOptimizedDrawing: YES];
+ [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
sz.width = FRAME_COLUMN_WIDTH (f);
sz.height = FRAME_LINE_HEIGHT (f);
@@ -6021,6 +6022,42 @@
rows = r;
cols = c;
}
+- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions {
+ return proposedOptions | NSApplicationPresentationAutoHideToolbar;
+}
+
+- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize {
+ NSRect r = NSMakeRect(0.f, 0.f, proposedSize.width, proposedSize.height);
+ int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
+ int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
+
+ change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
+ FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
+ FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
+
+ emacsframe->border_width = [window frame].size.width - r.size.width;
+ FRAME_NS_TITLEBAR_HEIGHT (emacsframe) = 0;
+
+ return proposedSize;
+}
+
+- (void)windowDidExitFullScreen:(NSNotification *)notification {
+ NSWindow* window = [notification object];
+
+ NSRect r = [window contentRectForFrameRect:[window frame]];
+ int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
+ int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
+
+ change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
+ FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
+ FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
+
+ emacsframe->border_width = [window frame].size.width - r.size.width;
+ FRAME_NS_TITLEBAR_HEIGHT (emacsframe) =
+ [window frame].size.height - r.size.height;
+
+ [[window delegate] windowDidMove:nil];
+}
@end /* EmacsView */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment