source: trunk/dports/aqua/emacs-app/files/patch-lion-fullscreen.diff @ 87876

Last change on this file since 87876 was 87876, checked in by hum@…, 8 years ago

emacs-app: add lion fullscreen patch; fetch 23.3b source tarball and add livecheck as well as emacs port; take joint maintainership; see #32288, r87595.

File size: 2.1 KB
RevLine 
[87876]1--- src/nsterm.m.old    2011-11-25 22:36:38.000000000 +0900
2+++ src/nsterm.m        2011-11-25 22:59:56.000000000 +0900
3@@ -5182,6 +5182,7 @@
4   [win setAcceptsMouseMovedEvents: YES];
5   [win setDelegate: self];
6   [win useOptimizedDrawing: YES];
7+  [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
8 
9   sz.width = FRAME_COLUMN_WIDTH (f);
10   sz.height = FRAME_LINE_HEIGHT (f);
11@@ -5671,6 +5672,43 @@
12   cols = c;
13 }
14 
15+- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions {
16+    return proposedOptions | NSApplicationPresentationAutoHideToolbar;
17+}
18+
19+- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize {
20+    NSRect r = NSMakeRect(0.f, 0.f, proposedSize.width, proposedSize.height);
21+    int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
22+    int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
23+
24+    change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
25+    FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
26+    FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
27+
28+    emacsframe->border_width = [window frame].size.width - r.size.width;
29+    FRAME_NS_TITLEBAR_HEIGHT (emacsframe) = 0;
30+
31+    return proposedSize;
32+}
33+
34+- (void)windowDidExitFullScreen:(NSNotification *)notification {
35+    NSWindow* window = [notification object];
36+
37+    NSRect r = [window contentRectForFrameRect:[window frame]];
38+    int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
39+    int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
40+
41+    change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
42+    FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
43+    FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
44+
45+    emacsframe->border_width = [window frame].size.width - r.size.width;
46+    FRAME_NS_TITLEBAR_HEIGHT (emacsframe) =
47+        [window frame].size.height - r.size.height;
48+
49+    [[window delegate] windowDidMove:nil];
50+}
51+
52 @end  /* EmacsView */
53 
54 
Note: See TracBrowser for help on using the repository browser.