diff options
| author | David Reitter | 2015-11-10 15:41:17 -0500 |
|---|---|---|
| committer | David Reitter | 2015-11-10 15:53:20 -0500 |
| commit | 0bba304045eec1b9e552c24fdf705646f24ec5a7 (patch) | |
| tree | 27afeb1e0eb84c82352a584cec870b935f1175f2 /src | |
| parent | 0e0ea300ff926d3e2f6f4d514d9115f1eecc8ddb (diff) | |
| download | emacs-0bba304045eec1b9e552c24fdf705646f24ec5a7.tar.gz emacs-0bba304045eec1b9e552c24fdf705646f24ec5a7.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index 5e6c7484331..5c39d5c0e4d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -6866,12 +6866,26 @@ not_in_argv (NSString *arg) | |||
| 6866 | } | 6866 | } |
| 6867 | #endif | 6867 | #endif |
| 6868 | 6868 | ||
| 6869 | #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | ||
| 6870 | #define NSWindowDidEnterFullScreenNotification "NSWindowDidEnterFullScreenNotification" | ||
| 6871 | #endif | ||
| 6872 | |||
| 6869 | - (void)windowWillEnterFullScreen:(NSNotification *)notification | 6873 | - (void)windowWillEnterFullScreen:(NSNotification *)notification |
| 6870 | { | 6874 | { |
| 6875 | [self windowWillEnterFullScreen]; | ||
| 6876 | } | ||
| 6877 | - (void)windowWillEnterFullScreen /* provided for direct calls */ | ||
| 6878 | { | ||
| 6871 | NSTRACE ("windowWillEnterFullScreen"); | 6879 | NSTRACE ("windowWillEnterFullScreen"); |
| 6872 | fs_before_fs = fs_state; | 6880 | fs_before_fs = fs_state; |
| 6873 | } | 6881 | } |
| 6874 | 6882 | ||
| 6883 | - (void)windowDidEnterFullScreen /* provided for direct calls */ | ||
| 6884 | { | ||
| 6885 | [self windowDidEnterFullScreen: | ||
| 6886 | [NSNotification notificationWithName:NSWindowDidEnterFullScreenNotification | ||
| 6887 | object:[self window]]]; | ||
| 6888 | } | ||
| 6875 | - (void)windowDidEnterFullScreen:(NSNotification *)notification | 6889 | - (void)windowDidEnterFullScreen:(NSNotification *)notification |
| 6876 | { | 6890 | { |
| 6877 | NSTRACE ("windowDidEnterFullScreen"); | 6891 | NSTRACE ("windowDidEnterFullScreen"); |
| @@ -6908,6 +6922,11 @@ not_in_argv (NSString *arg) | |||
| 6908 | 6922 | ||
| 6909 | - (void)windowWillExitFullScreen:(NSNotification *)notification | 6923 | - (void)windowWillExitFullScreen:(NSNotification *)notification |
| 6910 | { | 6924 | { |
| 6925 | [self windowWillExitFullScreen]; | ||
| 6926 | } | ||
| 6927 | |||
| 6928 | - (void)windowWillExitFullScreen /* provided for direct calls */ | ||
| 6929 | { | ||
| 6911 | NSTRACE ("windowWillExitFullScreen"); | 6930 | NSTRACE ("windowWillExitFullScreen"); |
| 6912 | if (!FRAME_LIVE_P (emacsframe)) | 6931 | if (!FRAME_LIVE_P (emacsframe)) |
| 6913 | { | 6932 | { |
| @@ -6920,6 +6939,11 @@ not_in_argv (NSString *arg) | |||
| 6920 | 6939 | ||
| 6921 | - (void)windowDidExitFullScreen:(NSNotification *)notification | 6940 | - (void)windowDidExitFullScreen:(NSNotification *)notification |
| 6922 | { | 6941 | { |
| 6942 | [self windowDidExitFullScreen]; | ||
| 6943 | } | ||
| 6944 | |||
| 6945 | - (void)windowDidExitFullScreen /* provided for direct calls */ | ||
| 6946 | { | ||
| 6923 | NSTRACE ("windowDidExitFullScreen"); | 6947 | NSTRACE ("windowDidExitFullScreen"); |
| 6924 | if (!FRAME_LIVE_P (emacsframe)) | 6948 | if (!FRAME_LIVE_P (emacsframe)) |
| 6925 | { | 6949 | { |
| @@ -7054,17 +7078,13 @@ not_in_argv (NSString *arg) | |||
| 7054 | 7078 | ||
| 7055 | nonfs_window = w; | 7079 | nonfs_window = w; |
| 7056 | 7080 | ||
| 7057 | [self windowWillEnterFullScreen: | 7081 | [self windowWillEnterFullScreen]; |
| 7058 | [NSNotification notificationWithName:NSWindowWillEnterFullScreenNotification | ||
| 7059 | object:[self window]]]; | ||
| 7060 | [fw makeKeyAndOrderFront:NSApp]; | 7082 | [fw makeKeyAndOrderFront:NSApp]; |
| 7061 | [fw makeFirstResponder:self]; | 7083 | [fw makeFirstResponder:self]; |
| 7062 | [w orderOut:self]; | 7084 | [w orderOut:self]; |
| 7063 | r = [fw frameRectForContentRect:[screen frame]]; | 7085 | r = [fw frameRectForContentRect:[screen frame]]; |
| 7064 | [fw setFrame: r display:YES animate:ns_use_fullscreen_animation]; | 7086 | [fw setFrame: r display:YES animate:ns_use_fullscreen_animation]; |
| 7065 | [self windowDidEnterFullScreen: | 7087 | [self windowDidEnterFullScreen]; |
| 7066 | [NSNotification notificationWithName:NSWindowDidEnterFullScreenNotification | ||
| 7067 | object:[self window]]]; | ||
| 7068 | [fw display]; | 7088 | [fw display]; |
| 7069 | } | 7089 | } |
| 7070 | else | 7090 | else |
| @@ -7094,15 +7114,11 @@ not_in_argv (NSString *arg) | |||
| 7094 | 7114 | ||
| 7095 | // to do: consider using [NSNotificationCenter postNotificationName:] to send notifications. | 7115 | // to do: consider using [NSNotificationCenter postNotificationName:] to send notifications. |
| 7096 | 7116 | ||
| 7097 | [self windowWillExitFullScreen: | 7117 | [self windowWillExitFullScreen]; |
| 7098 | [NSNotification notificationWithName:NSWindowWillExitFullScreenNotification | ||
| 7099 | object:[self window]]]; | ||
| 7100 | [fw setFrame: [w frame] display:YES animate:ns_use_fullscreen_animation]; | 7118 | [fw setFrame: [w frame] display:YES animate:ns_use_fullscreen_animation]; |
| 7101 | [fw close]; | 7119 | [fw close]; |
| 7102 | [w makeKeyAndOrderFront:NSApp]; | 7120 | [w makeKeyAndOrderFront:NSApp]; |
| 7103 | [self windowDidExitFullScreen: | 7121 | [self windowDidExitFullScreen]; |
| 7104 | [NSNotification notificationWithName:NSWindowDidExitFullScreenNotification | ||
| 7105 | object:[self window]]]; | ||
| 7106 | [self updateFrameSize:YES]; | 7122 | [self updateFrameSize:YES]; |
| 7107 | } | 7123 | } |
| 7108 | } | 7124 | } |