* lisp/cus-start.el (all): Add ns-use-native-fullscreen.
* src/nsmenu.m (update_frame_tool_bar): Check for negative tool bar height. * src/nsterm.h (HAVE_NATIVE_FS): Define if OSX => 10.7. (EmacsView): Add fs_is_native, fsIsNative, isFullscreen and updateCollectionBehaviour. * src/nsterm.m (NEW_STYLE_FS): Remove. (ns_last_use_native_fullscreen): New variable. (x_make_frame_visible): Replace NEW_STYLE_FS with isFullscreen. (x_set_window_size): Do not take title bar and tool bar into account if isFullscreen returns YES. (ns_fullscreen_hook): Replace NEW_STYLE_FS with isFullscreen. (check_native_fs): New function. (ns_select, ns_read_socket): Call check_native_fs if HAVE_NATIVE_FS. (ns_term_init): Remove NEW_STYLE_FS. (updateFrameSize:, windowWillResize:toSize:): Only adjust for title bar and tool bar if isFullscreen returns NO. (windowDidResize:): Replace NEW_STYLE_FS with fsIsNative. (initFrameFromEmacs:): Initialize fs_is_native. Replace NEW_STYLE_FS with HAVE_NATIVE_FS. (window:willUseFullScreenPresentationOptions:): New method. (windowDidEnterFullScreen:): Replace NEW_STYLE_FS with fsIsNative. Hide toolbar if not enabled. (windowDidExitFullScreen:): Call updateCollectionBehaviour. Restore tool bar if enabled, hide it otherwise (Bug#13444). (fsIsNative, isFullscreen, updateCollectionBehaviour): New methods. (toggleFullScreen:): If fs_is_native, call toggleFullScreen on window. Do no set FRAME_EXTERNAL_TOOL_BAR (f) to 0. Check FRAME_EXTERNAL_TOOL_BAR (f) before restoring FRAME_TOOLBAR_HEIGHT (f). Call updateFrameSize when going non-fs. (syms_of_nsterm): Add ns-use-native-fullscreen.
This commit is contained in:
parent
ed746aa721
commit
6871e574da
6 changed files with 221 additions and 73 deletions
|
@ -1,3 +1,7 @@
|
|||
2013-02-05 Jan Djärv <jan.h.d@swipnet.se>
|
||||
|
||||
* cus-start.el (all): Add ns-use-native-fullscreen.
|
||||
|
||||
2013-02-05 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* profiler.el (profiler-report-mode-map): Add a restart menu entry.
|
||||
|
|
|
@ -398,6 +398,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
|
|||
(const super)) "23.1")
|
||||
(ns-antialias-text ns boolean "23.1")
|
||||
(ns-auto-hide-menu-bar ns boolean "24.0")
|
||||
(ns-use-native-fullscreen ns boolean "24.4")
|
||||
;; process.c
|
||||
(delete-exited-processes processes-basics boolean)
|
||||
;; syntax.c
|
||||
|
|
|
@ -1,3 +1,38 @@
|
|||
2013-02-05 Jan Djärv <jan.h.d@swipnet.se>
|
||||
|
||||
* nsmenu.m (update_frame_tool_bar): Check for negative tool bar
|
||||
height.
|
||||
|
||||
* nsterm.h (HAVE_NATIVE_FS): Define if OSX => 10.7.
|
||||
(EmacsView): Add fs_is_native, fsIsNative, isFullscreen and
|
||||
updateCollectionBehaviour.
|
||||
|
||||
* nsterm.m (NEW_STYLE_FS): Remove.
|
||||
(ns_last_use_native_fullscreen): New variable.
|
||||
(x_make_frame_visible): Replace NEW_STYLE_FS with isFullscreen.
|
||||
(x_set_window_size): Do not take title bar and tool bar into account
|
||||
if isFullscreen returns YES.
|
||||
(ns_fullscreen_hook): Replace NEW_STYLE_FS with isFullscreen.
|
||||
(check_native_fs): New function.
|
||||
(ns_select, ns_read_socket): Call check_native_fs if HAVE_NATIVE_FS.
|
||||
(ns_term_init): Remove NEW_STYLE_FS.
|
||||
(updateFrameSize:, windowWillResize:toSize:): Only adjust for title bar
|
||||
and tool bar if isFullscreen returns NO.
|
||||
(windowDidResize:): Replace NEW_STYLE_FS with fsIsNative.
|
||||
(initFrameFromEmacs:): Initialize fs_is_native. Replace NEW_STYLE_FS
|
||||
with HAVE_NATIVE_FS.
|
||||
(window:willUseFullScreenPresentationOptions:): New method.
|
||||
(windowDidEnterFullScreen:): Replace NEW_STYLE_FS with fsIsNative.
|
||||
Hide toolbar if not enabled (Bug#13444).
|
||||
(windowDidExitFullScreen:): Call updateCollectionBehaviour.
|
||||
Restore tool bar if enabled, hide it otherwise (Bug#13444).
|
||||
(fsIsNative, isFullscreen, updateCollectionBehaviour): New methods.
|
||||
(toggleFullScreen:): If fs_is_native, call toggleFullScreen on
|
||||
window. Do no set FRAME_EXTERNAL_TOOL_BAR (f) to 0.
|
||||
Check FRAME_EXTERNAL_TOOL_BAR (f) before restoring
|
||||
FRAME_TOOLBAR_HEIGHT (f). Call updateFrameSize when going non-fs.
|
||||
(syms_of_nsterm): Add ns-use-native-fullscreen.
|
||||
|
||||
2013-02-04 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* fileio.c (Qchoose_write_coding_system): Now static.
|
||||
|
|
|
@ -1110,6 +1110,8 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
|
|||
FRAME_TOOLBAR_HEIGHT (f) =
|
||||
NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
|
||||
- FRAME_NS_TITLEBAR_HEIGHT (f);
|
||||
if (FRAME_TOOLBAR_HEIGHT (f) < 0) // happens if frame is fullscreen.
|
||||
FRAME_TOOLBAR_HEIGHT (f) = 0;
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
|
11
src/nsterm.h
11
src/nsterm.h
|
@ -42,6 +42,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#ifndef MAC_OS_X_VERSION_10_8
|
||||
#define MAC_OS_X_VERSION_10_8 1080
|
||||
#endif
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
#define HAVE_NATIVE_FS
|
||||
#endif
|
||||
|
||||
#endif /* NS_IMPL_COCOA */
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
@ -88,6 +93,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
int tibar_height, tobar_height, bwidth;
|
||||
int maximized_width, maximized_height;
|
||||
NSWindow *nonfs_window;
|
||||
BOOL fs_is_native;
|
||||
@public
|
||||
struct frame *emacsframe;
|
||||
int rows, cols;
|
||||
|
@ -115,6 +121,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
- (void) handleFS;
|
||||
- (void) setFSValue: (int)value;
|
||||
- (void) toggleFullScreen: (id) sender;
|
||||
- (BOOL) fsIsNative;
|
||||
- (BOOL) isFullscreen;
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
- (void) updateCollectionBehaviour;
|
||||
#endif
|
||||
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
/* Not declared, but useful. */
|
||||
|
|
241
src/nsterm.m
241
src/nsterm.m
|
@ -69,11 +69,6 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
#define NSTRACE(x)
|
||||
#endif
|
||||
|
||||
#if defined (NS_IMPL_COCOA) && \
|
||||
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
#define NEW_STYLE_FS
|
||||
#endif
|
||||
|
||||
extern NSString *NSMenuDidBeginTrackingNotification;
|
||||
|
||||
/* ==========================================================================
|
||||
|
@ -224,6 +219,7 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
static NSMutableArray *ns_pending_files, *ns_pending_service_names,
|
||||
*ns_pending_service_args;
|
||||
static BOOL ns_do_open_file = NO;
|
||||
static BOOL ns_last_use_native_fullscreen;
|
||||
|
||||
static struct {
|
||||
struct input_event *q;
|
||||
|
@ -1094,13 +1090,12 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
SET_FRAME_VISIBLE (f, 1);
|
||||
ns_raise_frame (f);
|
||||
|
||||
#ifdef NEW_STYLE_FS
|
||||
/* Making a new frame from a fullscreen frame will make the new frame
|
||||
fullscreen also. So skip handleFS as this will print an error. */
|
||||
if (f->want_fullscreen == FULLSCREEN_BOTH
|
||||
&& ([[view window] styleMask] & NSFullScreenWindowMask) != 0)
|
||||
if ([view fsIsNative] && f->want_fullscreen == FULLSCREEN_BOTH
|
||||
&& [view isFullscreen])
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (f->want_fullscreen != FULLSCREEN_NONE)
|
||||
{
|
||||
block_input ();
|
||||
|
@ -1292,7 +1287,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
|
||||
|
||||
/* If we have a toolbar, take its height into account. */
|
||||
if (tb)
|
||||
if (tb && ! [view isFullscreen])
|
||||
/* NOTE: previously this would generate wrong result if toolbar not
|
||||
yet displayed and fixing toolbar_height=32 helped, but
|
||||
now (200903) seems no longer needed */
|
||||
|
@ -1303,8 +1298,10 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
FRAME_TOOLBAR_HEIGHT (f) = 0;
|
||||
|
||||
wr.size.width = pixelwidth + f->border_width;
|
||||
wr.size.height = pixelheight + FRAME_NS_TITLEBAR_HEIGHT (f)
|
||||
+ FRAME_TOOLBAR_HEIGHT (f);
|
||||
wr.size.height = pixelheight;
|
||||
if (! [view isFullscreen])
|
||||
wr.size.height += FRAME_NS_TITLEBAR_HEIGHT (f)
|
||||
+ FRAME_TOOLBAR_HEIGHT (f);
|
||||
|
||||
/* Do not try to constrain to this screen. We may have multiple
|
||||
screens, and want Emacs to span those. Constraining to screen
|
||||
|
@ -1355,8 +1352,7 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
if (!FRAME_VISIBLE_P (f))
|
||||
return;
|
||||
|
||||
#ifndef NEW_STYLE_FS
|
||||
if (f->want_fullscreen == FULLSCREEN_BOTH)
|
||||
if (! [view fsIsNative] && f->want_fullscreen == FULLSCREEN_BOTH)
|
||||
{
|
||||
/* Old style fs don't initiate correctly if created from
|
||||
init/default-frame alist, so use a timer (not nice...).
|
||||
|
@ -1366,7 +1362,6 @@ Free a pool and temporary objects it refers to (callable from C)
|
|||
userInfo: nil repeats: NO];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
block_input ();
|
||||
[view handleFS];
|
||||
|
@ -3369,6 +3364,30 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
static void
|
||||
check_native_fs ()
|
||||
{
|
||||
Lisp_Object frame, tail;
|
||||
|
||||
if (ns_last_use_native_fullscreen == ns_use_native_fullscreen)
|
||||
return;
|
||||
|
||||
ns_last_use_native_fullscreen = ns_use_native_fullscreen;
|
||||
|
||||
/* Clear the mouse-moved flag for every frame on this display. */
|
||||
FOR_EACH_FRAME (tail, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
if (FRAME_NS_P (f))
|
||||
{
|
||||
EmacsView *view = FRAME_NS_VIEW (f);
|
||||
[view updateCollectionBehaviour];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
|
||||
/* --------------------------------------------------------------------------
|
||||
|
@ -3382,6 +3401,10 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
|
||||
/* NSTRACE (ns_read_socket); */
|
||||
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
check_native_fs ();
|
||||
#endif
|
||||
|
||||
if ([NSApp modalWindow] != nil)
|
||||
return -1;
|
||||
|
||||
|
@ -3459,6 +3482,10 @@ overwriting cursor (usually when cursor on a tab) */
|
|||
|
||||
/* NSTRACE (ns_select); */
|
||||
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
check_native_fs ();
|
||||
#endif
|
||||
|
||||
if (hold_event_q.nr > 0)
|
||||
{
|
||||
/* We already have events pending. */
|
||||
|
@ -4238,11 +4265,9 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
|
|||
NSColorPboardType,
|
||||
NSFontPboardType, nil] retain];
|
||||
|
||||
#ifndef NEW_STYLE_FS
|
||||
/* If fullscreen is in init/default-frame-alist, focus isn't set
|
||||
right for fullscreen windows, so set this. */
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
#endif
|
||||
|
||||
[NSApp run];
|
||||
ns_do_open_file = YES;
|
||||
|
@ -5391,10 +5416,10 @@ - (void) updateFrameSize: (BOOL) delay;
|
|||
{
|
||||
NSWindow *window = [self window];
|
||||
NSRect wr = [window frame];
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
int extra = 3;
|
||||
#else
|
||||
int extra = 0;
|
||||
int gsextra = 0;
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
gsextra = 3;
|
||||
#endif
|
||||
|
||||
int oldc = cols, oldr = rows;
|
||||
|
@ -5402,23 +5427,24 @@ - (void) updateFrameSize: (BOOL) delay;
|
|||
oldh = FRAME_PIXEL_HEIGHT (emacsframe);
|
||||
int neww, newh;
|
||||
|
||||
cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + extra);
|
||||
cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + gsextra);
|
||||
|
||||
if (cols < MINWIDTH)
|
||||
cols = MINWIDTH;
|
||||
|
||||
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES
|
||||
(emacsframe, wr.size.height
|
||||
- FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + extra
|
||||
- FRAME_TOOLBAR_HEIGHT (emacsframe));
|
||||
if (! [self isFullscreen])
|
||||
{
|
||||
extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
|
||||
+ FRAME_TOOLBAR_HEIGHT (emacsframe) - gsextra;
|
||||
}
|
||||
|
||||
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, wr.size.height - extra);
|
||||
|
||||
if (rows < MINHEIGHT)
|
||||
rows = MINHEIGHT;
|
||||
|
||||
neww = (int)wr.size.width - emacsframe->border_width;
|
||||
newh = ((int)wr.size.height
|
||||
- FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
|
||||
- FRAME_TOOLBAR_HEIGHT (emacsframe));
|
||||
newh = (int)wr.size.height - extra;
|
||||
|
||||
if (oldr != rows || oldc != cols || neww != oldw || newh != oldh)
|
||||
{
|
||||
|
@ -5436,6 +5462,12 @@ - (void) updateFrameSize: (BOOL) delay;
|
|||
- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
|
||||
/* normalize frame to gridded text size */
|
||||
{
|
||||
int extra = 0;
|
||||
int gsextra = 0;
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
gsextra = 3;
|
||||
#endif
|
||||
|
||||
NSTRACE (windowWillResize);
|
||||
/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */
|
||||
|
||||
|
@ -5453,22 +5485,12 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
|
|||
maximized_width = maximized_height = -1;
|
||||
|
||||
cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe,
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
frameSize.width + 3);
|
||||
#else
|
||||
frameSize.width);
|
||||
#endif
|
||||
frameSize.width + gsextra);
|
||||
if (cols < MINWIDTH)
|
||||
cols = MINWIDTH;
|
||||
|
||||
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe, frameSize.height
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
- FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + 3
|
||||
- FRAME_TOOLBAR_HEIGHT (emacsframe));
|
||||
#else
|
||||
- FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
|
||||
- FRAME_TOOLBAR_HEIGHT (emacsframe));
|
||||
#endif
|
||||
rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe,
|
||||
frameSize.height - extra);
|
||||
if (rows < MINHEIGHT)
|
||||
rows = MINHEIGHT;
|
||||
#ifdef NS_IMPL_COCOA
|
||||
|
@ -5511,12 +5533,13 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
|
|||
|
||||
- (void)windowDidResize: (NSNotification *)notification
|
||||
{
|
||||
|
||||
#if !defined (NEW_STYLE_FS) && ! defined (NS_IMPL_GNUSTEP)
|
||||
NSWindow *theWindow = [notification object];
|
||||
/* We can get notification on the non-FS window when in fullscreen mode. */
|
||||
if ([self window] != theWindow) return;
|
||||
#endif
|
||||
if (! [self fsIsNative])
|
||||
{
|
||||
NSWindow *theWindow = [notification object];
|
||||
/* We can get notification on the non-FS window when in
|
||||
fullscreen mode. */
|
||||
if ([self window] != theWindow) return;
|
||||
}
|
||||
|
||||
#ifdef NS_IMPL_GNUSTEP
|
||||
NSWindow *theWindow = [notification object];
|
||||
|
@ -5632,6 +5655,11 @@ - (BOOL)isOpaque
|
|||
scrollbarsNeedingUpdate = 0;
|
||||
fs_state = FULLSCREEN_NONE;
|
||||
fs_before_fs = next_maximized = -1;
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
fs_is_native = ns_use_native_fullscreen;
|
||||
#else
|
||||
fs_is_native = NO;
|
||||
#endif
|
||||
maximized_width = maximized_height = -1;
|
||||
nonfs_window = nil;
|
||||
|
||||
|
@ -5658,7 +5686,7 @@ - (BOOL)isOpaque
|
|||
backing: NSBackingStoreBuffered
|
||||
defer: YES];
|
||||
|
||||
#ifdef NEW_STYLE_FS
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
[win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
#endif
|
||||
|
||||
|
@ -5867,6 +5895,15 @@ - (void)windowDidMiniaturize: sender
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
- (NSApplicationPresentationOptions)window:(NSWindow *)window
|
||||
willUseFullScreenPresentationOptions:
|
||||
(NSApplicationPresentationOptions)proposedOptions
|
||||
{
|
||||
return proposedOptions|NSApplicationPresentationAutoHideToolbar;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)windowWillEnterFullScreen:(NSNotification *)notification
|
||||
{
|
||||
fs_before_fs = fs_state;
|
||||
|
@ -5875,17 +5912,13 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification
|
|||
- (void)windowDidEnterFullScreen:(NSNotification *)notification
|
||||
{
|
||||
[self setFSValue: FULLSCREEN_BOTH];
|
||||
#ifdef NEW_STYLE_FS
|
||||
// Fix bad background.
|
||||
if ([toolbar isVisible])
|
||||
if (! [self fsIsNative])
|
||||
{
|
||||
[toolbar setVisible:NO];
|
||||
[toolbar setVisible:YES];
|
||||
[self windowDidBecomeKey:notification];
|
||||
[nonfs_window orderOut:self];
|
||||
}
|
||||
#else
|
||||
[self windowDidBecomeKey:notification];
|
||||
[nonfs_window orderOut:self];
|
||||
#endif
|
||||
else if (! FRAME_EXTERNAL_TOOL_BAR (emacsframe))
|
||||
[toolbar setVisible:NO];
|
||||
}
|
||||
|
||||
- (void)windowWillExitFullScreen:(NSNotification *)notification
|
||||
|
@ -5898,24 +5931,76 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification
|
|||
{
|
||||
[self setFSValue: fs_before_fs];
|
||||
fs_before_fs = -1;
|
||||
[self updateCollectionBehaviour];
|
||||
if (FRAME_EXTERNAL_TOOL_BAR (emacsframe))
|
||||
{
|
||||
[toolbar setVisible:YES];
|
||||
update_frame_tool_bar (emacsframe);
|
||||
[self updateFrameSize:YES];
|
||||
[[self window] display];
|
||||
}
|
||||
else
|
||||
[toolbar setVisible:NO];
|
||||
|
||||
if (next_maximized != -1)
|
||||
[[self window] performZoom:self];
|
||||
}
|
||||
|
||||
- (BOOL)fsIsNative
|
||||
{
|
||||
return fs_is_native;
|
||||
}
|
||||
|
||||
- (BOOL)isFullscreen
|
||||
{
|
||||
if (! fs_is_native) return nonfs_window != nil;
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
return ([[self window] styleMask] & NSFullScreenWindowMask) != 0;
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
- (void)updateCollectionBehaviour
|
||||
{
|
||||
if (! [self isFullscreen])
|
||||
{
|
||||
NSWindow *win = [self window];
|
||||
NSWindowCollectionBehavior b = [win collectionBehavior];
|
||||
if (ns_use_native_fullscreen)
|
||||
b |= NSWindowCollectionBehaviorFullScreenPrimary;
|
||||
else
|
||||
b &= ~NSWindowCollectionBehaviorFullScreenPrimary;
|
||||
|
||||
[win setCollectionBehavior: b];
|
||||
fs_is_native = ns_use_native_fullscreen;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)toggleFullScreen: (id)sender
|
||||
{
|
||||
#ifdef NEW_STYLE_FS
|
||||
[[self window] toggleFullScreen:sender];
|
||||
#else
|
||||
NSWindow *w = [self window], *fw;
|
||||
BOOL onFirstScreen = [[w screen]
|
||||
isEqual:[[NSScreen screens] objectAtIndex:0]];
|
||||
struct frame *f = emacsframe;
|
||||
NSWindow *w, *fw;
|
||||
BOOL onFirstScreen;
|
||||
struct frame *f;
|
||||
NSSize sz;
|
||||
NSRect r, wr = [w frame];
|
||||
NSColor *col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
|
||||
(FRAME_DEFAULT_FACE (f)),
|
||||
f);
|
||||
NSRect r, wr;
|
||||
NSColor *col;
|
||||
|
||||
if (fs_is_native)
|
||||
{
|
||||
[[self window] toggleFullScreen:sender];
|
||||
return;
|
||||
}
|
||||
|
||||
w = [self window];
|
||||
onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]];
|
||||
f = emacsframe;
|
||||
wr = [w frame];
|
||||
col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
|
||||
(FRAME_DEFAULT_FACE (f)),
|
||||
f);
|
||||
|
||||
sz.width = FRAME_COLUMN_WIDTH (f);
|
||||
sz.height = FRAME_LINE_HEIGHT (f);
|
||||
|
@ -5958,7 +6043,6 @@ - (void)toggleFullScreen: (id)sender
|
|||
FRAME_NS_TITLEBAR_HEIGHT (f) = 0;
|
||||
tobar_height = FRAME_TOOLBAR_HEIGHT (f);
|
||||
FRAME_TOOLBAR_HEIGHT (f) = 0;
|
||||
FRAME_EXTERNAL_TOOL_BAR (f) = 0;
|
||||
|
||||
nonfs_window = w;
|
||||
|
||||
|
@ -5995,17 +6079,16 @@ - (void)toggleFullScreen: (id)sender
|
|||
|
||||
f->border_width = bwidth;
|
||||
FRAME_NS_TITLEBAR_HEIGHT (f) = tibar_height;
|
||||
FRAME_TOOLBAR_HEIGHT (f) = tobar_height;
|
||||
if (tobar_height)
|
||||
FRAME_EXTERNAL_TOOL_BAR (f) = 1;
|
||||
if (FRAME_EXTERNAL_TOOL_BAR (f))
|
||||
FRAME_TOOLBAR_HEIGHT (f) = tobar_height;
|
||||
|
||||
[self windowWillExitFullScreen:nil];
|
||||
[fw setFrame: [w frame] display:YES animate:YES];
|
||||
[fw close];
|
||||
[w makeKeyAndOrderFront:NSApp];
|
||||
[self windowDidExitFullScreen:nil];
|
||||
[self updateFrameSize:YES];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)handleFS
|
||||
|
@ -7159,6 +7242,18 @@ Convert an X font name (XLFD) to an NS font name.
|
|||
Only works on OSX 10.6 or later. */);
|
||||
ns_auto_hide_menu_bar = Qnil;
|
||||
|
||||
DEFVAR_BOOL ("ns-use-native-fullscreen", ns_use_native_fullscreen,
|
||||
doc: /*Non-nil means to use native fullscreen on OSX >= 10.7.
|
||||
Nil means use fullscreen the old (< 10.7) way. The old way works better with
|
||||
multiple monitors, but lacks tool bar. This variable is ignored on OSX < 10.7.
|
||||
Default is t for OSX >= 10.7, nil otherwise. */);
|
||||
#ifdef HAVE_NATIVE_FS
|
||||
ns_use_native_fullscreen = YES;
|
||||
#else
|
||||
ns_use_native_fullscreen = NO;
|
||||
#endif
|
||||
ns_last_use_native_fullscreen = ns_use_native_fullscreen;
|
||||
|
||||
/* TODO: move to common code */
|
||||
DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
|
||||
doc: /* Which toolkit scroll bars Emacs uses, if any.
|
||||
|
|
Loading…
Add table
Reference in a new issue