Created
August 28, 2011 06:20
-
-
Save henry0312/1176311 to your computer and use it in GitHub Desktop.
Add features for Lion to Emacs 23.3a
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 30b73c2..6597790 100644 | |
--- a/src/nsterm.m | |
+++ b/src/nsterm.m | |
@@ -4488,7 +4488,7 @@ ns_term_shutdown (int sig) | |
code, fnKeysym, flags, emacs_event->modifiers); | |
/* if it was a function key or had modifiers, pass it directly to emacs */ | |
- if (fnKeysym || (emacs_event->modifiers | |
+ if (fnKeysym || (emacs_event->modifiers && (emacs_event->modifiers != shift_modifier) | |
&& [[theEvent charactersIgnoringModifiers] length] > 0)) | |
/*[[theEvent characters] length] */ | |
{ | |
@@ -5106,7 +5106,8 @@ ns_term_shutdown (int sig) | |
win = [[EmacsWindow alloc] | |
initWithContentRect: r | |
- styleMask: (NSResizableWindowMask | | |
+ styleMask: (NSTitledWindowMask | | |
+ NSResizableWindowMask | | |
NSMiniaturizableWindowMask | | |
NSClosableWindowMask) | |
backing: NSBackingStoreBuffered | |
@@ -5119,6 +5120,7 @@ ns_term_shutdown (int sig) | |
[win setAcceptsMouseMovedEvents: YES]; | |
[win setDelegate: self]; | |
[win useOptimizedDrawing: YES]; | |
+ [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; | |
sz.width = FRAME_COLUMN_WIDTH (f); | |
sz.height = FRAME_LINE_HEIGHT (f); | |
@@ -5608,6 +5610,43 @@ ns_term_shutdown (int sig) | |
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
Original Patches:
https://github.com/downloads/typester/emacs/emacs-23-lion-fullscreen-test.patch
https://github.com/downloads/typester/emacs/fix-shiftmodifier-with-ime.patch