Commit 0bba3040 authored by David Reitter's avatar David Reitter

Avoid creating notification objects when possible

* src/nsterm.m (windowWillEnterFullScreen, windowWillExitFullScreen:,
windowDidEnterFullScreen, windowDidExitFullScreen): provide
convenience functions that do not require a notification object.  When
needed, define NSWindowDidEnterFullScreenNotification to allow for
compilation on OS X 10.6.8.
parent 0e0ea300
......@@ -6866,12 +6866,26 @@ - (NSApplicationPresentationOptions)window:(NSWindow *)window
}
#endif
#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
#define NSWindowDidEnterFullScreenNotification "NSWindowDidEnterFullScreenNotification"
#endif
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
[self windowWillEnterFullScreen];
}
- (void)windowWillEnterFullScreen /* provided for direct calls */
{
NSTRACE ("windowWillEnterFullScreen");
fs_before_fs = fs_state;
}
- (void)windowDidEnterFullScreen /* provided for direct calls */
{
[self windowDidEnterFullScreen:
[NSNotification notificationWithName:NSWindowDidEnterFullScreenNotification
object:[self window]]];
}
- (void)windowDidEnterFullScreen:(NSNotification *)notification
{
NSTRACE ("windowDidEnterFullScreen");
......@@ -6907,6 +6921,11 @@ - (void)windowDidEnterFullScreen:(NSNotification *)notification
}
- (void)windowWillExitFullScreen:(NSNotification *)notification
{
[self windowWillExitFullScreen];
}
- (void)windowWillExitFullScreen /* provided for direct calls */
{
NSTRACE ("windowWillExitFullScreen");
if (!FRAME_LIVE_P (emacsframe))
......@@ -6919,6 +6938,11 @@ - (void)windowWillExitFullScreen:(NSNotification *)notification
}
- (void)windowDidExitFullScreen:(NSNotification *)notification
{
[self windowDidExitFullScreen];
}
- (void)windowDidExitFullScreen /* provided for direct calls */
{
NSTRACE ("windowDidExitFullScreen");
if (!FRAME_LIVE_P (emacsframe))
......@@ -7054,17 +7078,13 @@ - (void)toggleFullScreen: (id)sender
nonfs_window = w;
[self windowWillEnterFullScreen:
[NSNotification notificationWithName:NSWindowWillEnterFullScreenNotification
object:[self window]]];
[self windowWillEnterFullScreen];
[fw makeKeyAndOrderFront:NSApp];
[fw makeFirstResponder:self];
[w orderOut:self];
r = [fw frameRectForContentRect:[screen frame]];
[fw setFrame: r display:YES animate:ns_use_fullscreen_animation];
[self windowDidEnterFullScreen:
[NSNotification notificationWithName:NSWindowDidEnterFullScreenNotification
object:[self window]]];
[self windowDidEnterFullScreen];
[fw display];
}
else
......@@ -7094,15 +7114,11 @@ - (void)toggleFullScreen: (id)sender
// to do: consider using [NSNotificationCenter postNotificationName:] to send notifications.
[self windowWillExitFullScreen:
[NSNotification notificationWithName:NSWindowWillExitFullScreenNotification
object:[self window]]];
[self windowWillExitFullScreen];
[fw setFrame: [w frame] display:YES animate:ns_use_fullscreen_animation];
[fw close];
[w makeKeyAndOrderFront:NSApp];
[self windowDidExitFullScreen:
[NSNotification notificationWithName:NSWindowDidExitFullScreenNotification
object:[self window]]];
[self windowDidExitFullScreen];
[self updateFrameSize:YES];
}
}
......
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