1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-30 08:09:04 +00:00

Fixed NextStep fullscreen issue (bug#22468)

When in fullscreen mode, `[screen visibleFrame]' sometimes
includes, sometimes excludes the menu bar. This could cause
a frame to be placed too low when in fullscreen mode.

* src/nsterm.m (ns_menu_bar_should_be_hidden): Trace.
(constrain_frame_rect): New parameter, isFullscreen, when true don't
query the height of the menu bar.
(ns_constrain_all_frames): Pass `false' (isFullscreen) to
`constrain_frame_rect'.
([EmacsView initFrameFromEmacs:]): Trace.
([EmacsView isFullscreen]): Trace.
([EmacsWindow constrainFrameRect:toScreen:]): Pass fullscreen
state to `constrain_frame_rect'.
This commit is contained in:
Anders Lindgren 2016-01-26 13:51:59 +01:00
parent da976cff35
commit 60902756b0

View File

@ -637,10 +637,11 @@ Free a pool and temporary objects it refers to (callable from C)
static CGFloat
ns_menu_bar_height (NSScreen *screen)
/* The height of the menu bar, if visible. */
{
// NSTRACE ("ns_menu_bar_height");
/* The height of the menu bar, if visible.
Note: Don't use this when fullscreen is enabled -- the screen
sometimes includes, sometimes excludes the menu bar area. */
{
CGFloat res;
if (ns_menu_bar_should_be_hidden())
@ -660,7 +661,7 @@ Free a pool and temporary objects it refers to (callable from C)
}
// NSTRACE_MSG (NSTRACE_FMT_RETURN "%.0f", res);
NSTRACE ("ns_menu_bar_height " NSTRACE_FMT_RETURN " %.0f", res);
return res;
}
@ -714,7 +715,7 @@ Free a pool and temporary objects it refers to (callable from C)
// Result: Menu bar visible, frame placed immediately below the menu.
//
static NSRect constrain_frame_rect(NSRect frameRect)
static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
{
NSTRACE ("constrain_frame_rect(" NSTRACE_FMT_RECT ")",
NSTRACE_ARG_RECT (frameRect));
@ -746,7 +747,11 @@ static NSRect constrain_frame_rect(NSRect frameRect)
{
multiscreenRect = NSUnionRect (multiscreenRect, scrRect);
menu_bar_height = max(menu_bar_height, ns_menu_bar_height (s));
if (!isFullscreen)
{
CGFloat screen_menu_bar_height = ns_menu_bar_height (s);
menu_bar_height = max(menu_bar_height, screen_menu_bar_height);
}
}
}
@ -840,7 +845,7 @@ static NSRect constrain_frame_rect(NSRect frameRect)
if (![view isFullscreen])
{
[[view window]
setFrame:constrain_frame_rect([[view window] frame])
setFrame:constrain_frame_rect([[view window] frame], false)
display:NO];
}
}
@ -6650,7 +6655,7 @@ - (BOOL)isOpaque
NSString *name;
NSTRACE ("[EmacsView initFrameFromEmacs:]");
NSTRACE_MSG ("cols:%d lines:%d\n", f->text_cols, f->text_lines);
NSTRACE_MSG ("cols:%d lines:%d", f->text_cols, f->text_lines);
windowClosing = NO;
processingCompose = NO;
@ -7099,14 +7104,25 @@ - (BOOL)fsIsNative
- (BOOL)isFullscreen
{
NSTRACE ("[EmacsView isFullscreen]");
BOOL res;
if (! fs_is_native) return nonfs_window != nil;
if (! fs_is_native)
{
res = (nonfs_window != nil);
}
else
{
#ifdef HAVE_NATIVE_FS
return ([[self window] styleMask] & NSFullScreenWindowMask) != 0;
res = (([[self window] styleMask] & NSFullScreenWindowMask) != 0);
#else
return NO;
res = NO;
#endif
}
NSTRACE ("[EmacsView isFullscreen] " NSTRACE_FMT_RETURN " %d",
(int) res);
return res;
}
#ifdef HAVE_NATIVE_FS
@ -7772,7 +7788,8 @@ - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
#endif
#endif
return constrain_frame_rect(frameRect);
return constrain_frame_rect(frameRect,
[(EmacsView *)[self delegate] isFullscreen]);
}