Commit 04fafa46 authored by Jan Djärv's avatar Jan Djärv

Handle fullscreen parameter in initial/defult-frame-alist for NS.

* nsfns.m (Fx_create_frame): Call x_default_parameter with
fullscreen/Fullscreen.

* nsterm.h (EmacsView): Rename tbar_height to tibar_height.
tobar_height is new.

* nsterm.m (x_make_frame_visible): Check for fullscreen.
(ns_fullscreen_hook): Activate old style fullscreen with a timer.
(ns_term_init): Set activateIgnoringOtherApps if old style fullscreen.
(windowDidResize:): Check for correct window if old style fullscreen.
Capitalize word in comment.  Remove incorrect comment.
(initFrameFromEmacs:): tbar_height renamed tibar_height.
(windowDidEnterFullScreen:): Toggle toolbar for fullscreen to fix
error in drawing background.
(toggleFullScreen:): Remove comment. Rearrange calls.
Set toolbar values to zero, save old height in tobar_height.
Restore tool bar height when leaving fullscreen.
(canBecomeMainWindow): New function.
parent d39109c3
2012-10-06 Jan Djärv <jan.h.d@swipnet.se>
* nsfns.m (Fx_create_frame): Call x_default_parameter with
fullscreen/Fullscreen.
* nsterm.h (EmacsView): Rename tbar_height to tibar_height.
tobar_height is new.
* nsterm.m (x_make_frame_visible): Check for fullscreen.
(ns_fullscreen_hook): Activate old style fullscreen with a timer.
(ns_term_init): Set activateIgnoringOtherApps if old style fullscreen.
(windowDidResize:): Check for correct window if old style fullscreen.
Capitalize word in comment. Remove incorrect comment.
(initFrameFromEmacs:): tbar_height renamed tibar_height.
(windowDidEnterFullScreen:): Toggle toolbar for fullscreen to fix
error in drawing background.
(toggleFullScreen:): Remove comment. Rearrange calls.
Set toolbar values to zero, save old height in tobar_height.
Restore tool bar height when leaving fullscreen.
(canBecomeMainWindow): New function.
2012-10-06 Paul Eggert <eggert@cs.ucla.edu>
* keyboard.c (read_char): Remove unnecessary 'volatile's and label.
......
......@@ -1346,6 +1346,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
RES_TYPE_NUMBER);
x_default_parameter (f, parms, Qalpha, Qnil,
"alpha", "Alpha", RES_TYPE_NUMBER);
x_default_parameter (f, parms, Qfullscreen, Qnil,
"fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
width = FRAME_COLS (f);
height = FRAME_LINES (f);
......
......@@ -86,7 +86,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
BOOL windowClosing;
NSString *workingText;
BOOL processingCompose;
int fs_state, fs_before_fs, next_maximized, tbar_height, bwidth;
int fs_state, fs_before_fs, next_maximized;
int tibar_height, tobar_height, bwidth;
int maximized_width, maximized_height;
NSWindow *nonfs_window;
@public
......
......@@ -1068,8 +1068,23 @@ Free a pool and temporary objects it refers to (callable from C)
if this ends up the case again, comment this out again. */
if (!FRAME_VISIBLE_P (f))
{
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
f->async_visible = 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)
return;
#endif
if (f->want_fullscreen != FULLSCREEN_NONE)
{
block_input ();
[view handleFS];
unblock_input ();
}
}
}
......@@ -1317,6 +1332,18 @@ Free a pool and temporary objects it refers to (callable from C)
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
if (! f->async_visible) return;
#ifndef NEW_STYLE_FS
if (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...).
*/
[NSTimer scheduledTimerWithTimeInterval: 0.5 target: view
selector: @selector (handleFS)
userInfo: nil repeats: NO];
return;
}
#endif
block_input ();
[view handleFS];
......@@ -4210,6 +4237,11 @@ 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;
......@@ -5505,10 +5537,17 @@ - (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
#ifdef NS_IMPL_GNUSTEP
NSWindow *theWindow = [notification object];
/* in GNUstep, at least currently, it's possible to get a didResize
/* In GNUstep, at least currently, it's possible to get a didResize
without getting a willResize.. therefore we need to act as if we got
the willResize now */
NSSize sz = [theWindow frame].size;
......@@ -5526,10 +5565,6 @@ - (void)windowDidResize: (NSNotification *)notification
}
#endif /* NS_IMPL_COCOA */
/* Avoid loop under GNUstep due to call at beginning of this function.
(x_set_window_size causes a resize which causes
a "windowDidResize" which calls x_set_window_size). */
#ifndef NS_IMPL_GNUSTEP
if (cols > 0 && rows > 0)
{
if (ns_in_resize)
......@@ -5539,7 +5574,6 @@ - (void)windowDidResize: (NSNotification *)notification
[self updateFrameSize: YES];
}
}
#endif
ns_send_appdefined (-1);
}
......@@ -5661,7 +5695,7 @@ - (BOOL)isOpaque
wr = [win frame];
bwidth = f->border_width = wr.size.width - r.size.width;
tbar_height = FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height;
tibar_height = FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height;
[win setAcceptsMouseMovedEvents: YES];
[win setDelegate: self];
......@@ -5870,8 +5904,16 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification
- (void)windowDidEnterFullScreen:(NSNotification *)notification
{
[self setFSValue: FULLSCREEN_BOTH];
#ifndef NEW_STYLE_FS
#ifdef NEW_STYLE_FS
// Fix bad background.
if ([toolbar isVisible])
{
[toolbar setVisible:NO];
[toolbar setVisible:YES];
}
#else
[self windowDidBecomeKey:notification];
[nonfs_window orderOut:self];
#endif
}
......@@ -5891,11 +5933,6 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification
- (void)toggleFullScreen: (id)sender
{
/* Bugs remain:
1) Having fullscreen in initial/default frame alist.
2) Fullscreen in default frame alist only applied to first frame.
*/
#ifdef NEW_STYLE_FS
[[self window] toggleFullScreen:sender];
#else
......@@ -5904,7 +5941,7 @@ - (void)toggleFullScreen: (id)sender
isEqual:[[NSScreen screens] objectAtIndex:0]];
struct frame *f = emacsframe;
NSSize sz;
NSRect r;
NSRect r, wr = [w frame];
NSColor *col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
(FRAME_DEFAULT_FACE (f)),
f);
......@@ -5930,7 +5967,7 @@ - (void)toggleFullScreen: (id)sender
}
fw = [[EmacsFSWindow alloc]
initWithContentRect:[w contentRectForFrameRect:[w frame]]
initWithContentRect:[w contentRectForFrameRect:wr]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES
......@@ -5938,9 +5975,7 @@ - (void)toggleFullScreen: (id)sender
[fw setContentView:[w contentView]];
[fw setTitle:[w title]];
[fw makeKeyAndOrderFront:NSApp];
[fw setDelegate:self];
[fw makeFirstResponder:self];
[fw setAcceptsMouseMovedEvents: YES];
[fw useOptimizedDrawing: YES];
[fw setResizeIncrements: sz];
......@@ -5950,18 +5985,26 @@ - (void)toggleFullScreen: (id)sender
f->border_width = 0;
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;
[self windowWillEnterFullScreen:nil];
[fw makeKeyAndOrderFront:NSApp];
[fw makeFirstResponder:self];
[w orderOut:self];
r = [fw frameRectForContentRect:[[fw screen] frame]];
[fw setFrame: r display:YES animate:YES];
[self windowDidEnterFullScreen:nil];
[fw display];
}
else
{
fw = w;
w = nonfs_window;
nonfs_window = nil;
if (onFirstScreen)
{
......@@ -5980,7 +6023,10 @@ - (void)toggleFullScreen: (id)sender
[w setOpaque: NO];
f->border_width = bwidth;
FRAME_NS_TITLEBAR_HEIGHT (f) = tbar_height;
FRAME_NS_TITLEBAR_HEIGHT (f) = tibar_height;
FRAME_TOOLBAR_HEIGHT (f) = tobar_height;
if (tobar_height)
FRAME_EXTERNAL_TOOL_BAR (f) = 1;
[self windowWillExitFullScreen:nil];
[fw setFrame: [w frame] display:YES animate:YES];
......@@ -6553,6 +6599,11 @@ - (BOOL)canBecomeKeyWindow
return YES;
}
- (BOOL)canBecomeMainWindow
{
return YES;
}
@end
/* ==========================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment