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())
}
- // NSTRACE_MSG (NSTRACE_FMT_RETURN "%.0f", res);
+ NSTRACE ("ns_menu_bar_height " NSTRACE_FMT_RETURN " %.0f", res);
return res;
}
// 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));
{
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);
+ }
}
}
if (![view isFullscreen])
{
[[view window]
- setFrame:constrain_frame_rect([[view window] frame])
+ setFrame:constrain_frame_rect([[view window] frame], false)
display:NO];
}
}
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;
- (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
#endif
#endif
- return constrain_frame_rect(frameRect);
+ return constrain_frame_rect(frameRect,
+ [(EmacsView *)[self delegate] isFullscreen]);
}