diff options
| author | Alan Third | 2020-03-02 17:54:32 +0000 |
|---|---|---|
| committer | Alan Third | 2020-03-02 18:30:44 +0000 |
| commit | b4911a6f0da0bfae3832b3aa0c111db4bb2f49d5 (patch) | |
| tree | 7c909d1bcc75f7ecb8bacd81d8a04648f7c8902c /src | |
| parent | 68109c56e45ff531934bfe81f9bd14a530a35574 (diff) | |
| download | emacs-b4911a6f0da0bfae3832b3aa0c111db4bb2f49d5.tar.gz emacs-b4911a6f0da0bfae3832b3aa0c111db4bb2f49d5.zip | |
Fix macOS/GNUstep compilation warnings
* src/nsfns.m (handlePanelKeys): Unused function.
* src/nsterm.m (ns_set_appearance):
([EmacsView initFrameFromEmacs:]): Use EmacsWindow type instead of
NSWindow.
(ns_clip_to_row): Unused function.
(ns_dumpglyphs_stretch): Remove unused variable.
(ns_term_init):
([EmacsWindow setAppearance]): Only compile on macOS.
(ns_mouse_position): Make sure f is initialised on GNUstep.
* src/emacs.c (main): Move allocation of autorelease pool to before
first use.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 3 | ||||
| -rw-r--r-- | src/nsfns.m | 74 | ||||
| -rw-r--r-- | src/nsterm.m | 26 |
3 files changed, 7 insertions, 96 deletions
diff --git a/src/emacs.c b/src/emacs.c index c170333e603..8b27c63f731 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1243,6 +1243,7 @@ main (int argc, char **argv) | |||
| 1243 | if (! (lc_all && strcmp (lc_all, "C") == 0)) | 1243 | if (! (lc_all && strcmp (lc_all, "C") == 0)) |
| 1244 | { | 1244 | { |
| 1245 | #ifdef HAVE_NS | 1245 | #ifdef HAVE_NS |
| 1246 | ns_pool = ns_alloc_autorelease_pool (); | ||
| 1246 | ns_init_locale (); | 1247 | ns_init_locale (); |
| 1247 | #endif | 1248 | #endif |
| 1248 | setlocale (LC_ALL, ""); | 1249 | setlocale (LC_ALL, ""); |
| @@ -1612,8 +1613,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1612 | #endif | 1613 | #endif |
| 1613 | 1614 | ||
| 1614 | #ifdef HAVE_NS | 1615 | #ifdef HAVE_NS |
| 1615 | ns_pool = ns_alloc_autorelease_pool (); | ||
| 1616 | |||
| 1617 | if (!noninteractive) | 1616 | if (!noninteractive) |
| 1618 | { | 1617 | { |
| 1619 | #ifdef NS_IMPL_COCOA | 1618 | #ifdef NS_IMPL_COCOA |
diff --git a/src/nsfns.m b/src/nsfns.m index cbde93b3f10..f6e7f4e9acb 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -3012,80 +3012,6 @@ DEFUN ("ns-show-character-palette", | |||
| 3012 | 3012 | ||
| 3013 | ========================================================================== */ | 3013 | ========================================================================== */ |
| 3014 | 3014 | ||
| 3015 | /* | ||
| 3016 | Handle arrow/function/control keys and copy/paste/cut in file dialogs. | ||
| 3017 | Return YES if handled, NO if not. | ||
| 3018 | */ | ||
| 3019 | static BOOL | ||
| 3020 | handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) | ||
| 3021 | { | ||
| 3022 | NSString *s; | ||
| 3023 | int i; | ||
| 3024 | BOOL ret = NO; | ||
| 3025 | |||
| 3026 | if ([theEvent type] != NSEventTypeKeyDown) return NO; | ||
| 3027 | s = [theEvent characters]; | ||
| 3028 | |||
| 3029 | for (i = 0; i < [s length]; ++i) | ||
| 3030 | { | ||
| 3031 | int ch = (int) [s characterAtIndex: i]; | ||
| 3032 | switch (ch) | ||
| 3033 | { | ||
| 3034 | case NSHomeFunctionKey: | ||
| 3035 | case NSDownArrowFunctionKey: | ||
| 3036 | case NSUpArrowFunctionKey: | ||
| 3037 | case NSLeftArrowFunctionKey: | ||
| 3038 | case NSRightArrowFunctionKey: | ||
| 3039 | case NSPageUpFunctionKey: | ||
| 3040 | case NSPageDownFunctionKey: | ||
| 3041 | case NSEndFunctionKey: | ||
| 3042 | /* Don't send command modified keys, as those are handled in the | ||
| 3043 | performKeyEquivalent method of the super class. */ | ||
| 3044 | if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand)) | ||
| 3045 | { | ||
| 3046 | [panel sendEvent: theEvent]; | ||
| 3047 | ret = YES; | ||
| 3048 | } | ||
| 3049 | break; | ||
| 3050 | /* As we don't have the standard key commands for | ||
| 3051 | copy/paste/cut/select-all in our edit menu, we must handle | ||
| 3052 | them here. TODO: handle Emacs key bindings for copy/cut/select-all | ||
| 3053 | here, paste works, because we have that in our Edit menu. | ||
| 3054 | I.e. refactor out code in nsterm.m, keyDown: to figure out the | ||
| 3055 | correct modifier. */ | ||
| 3056 | case 'x': // Cut | ||
| 3057 | case 'c': // Copy | ||
| 3058 | case 'v': // Paste | ||
| 3059 | case 'a': // Select all | ||
| 3060 | if ([theEvent modifierFlags] & NSEventModifierFlagCommand) | ||
| 3061 | { | ||
| 3062 | [NSApp sendAction: | ||
| 3063 | (ch == 'x' | ||
| 3064 | ? @selector(cut:) | ||
| 3065 | : (ch == 'c' | ||
| 3066 | ? @selector(copy:) | ||
| 3067 | : (ch == 'v' | ||
| 3068 | ? @selector(paste:) | ||
| 3069 | : @selector(selectAll:)))) | ||
| 3070 | to:nil from:panel]; | ||
| 3071 | ret = YES; | ||
| 3072 | } | ||
| 3073 | default: | ||
| 3074 | // Send all control keys, as the text field supports C-a, C-f, C-e | ||
| 3075 | // C-b and more. | ||
| 3076 | if ([theEvent modifierFlags] & NSEventModifierFlagControl) | ||
| 3077 | { | ||
| 3078 | [panel sendEvent: theEvent]; | ||
| 3079 | ret = YES; | ||
| 3080 | } | ||
| 3081 | break; | ||
| 3082 | } | ||
| 3083 | } | ||
| 3084 | |||
| 3085 | |||
| 3086 | return ret; | ||
| 3087 | } | ||
| 3088 | |||
| 3089 | @implementation EmacsFileDelegate | 3015 | @implementation EmacsFileDelegate |
| 3090 | /* -------------------------------------------------------------------------- | 3016 | /* -------------------------------------------------------------------------- |
| 3091 | Delegate methods for Open/Save panels | 3017 | Delegate methods for Open/Save panels |
diff --git a/src/nsterm.m b/src/nsterm.m index 57bb9b1dd83..8e256149220 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1238,20 +1238,6 @@ ns_unfocus (struct frame *f) | |||
| 1238 | } | 1238 | } |
| 1239 | 1239 | ||
| 1240 | 1240 | ||
| 1241 | static void | ||
| 1242 | ns_clip_to_row (struct window *w, struct glyph_row *row, | ||
| 1243 | enum glyph_row_area area, BOOL gc) | ||
| 1244 | /* -------------------------------------------------------------------------- | ||
| 1245 | Internal (but parallels other terms): Focus drawing on given row | ||
| 1246 | -------------------------------------------------------------------------- */ | ||
| 1247 | { | ||
| 1248 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 1249 | NSRect clip_rect = ns_row_rect (w, row, area); | ||
| 1250 | |||
| 1251 | ns_focus (f, &clip_rect, 1); | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | |||
| 1255 | /* ========================================================================== | 1241 | /* ========================================================================== |
| 1256 | 1242 | ||
| 1257 | Visible bell and beep. | 1243 | Visible bell and beep. |
| @@ -2089,7 +2075,7 @@ ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value | |||
| 2089 | { | 2075 | { |
| 2090 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 | 2076 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 |
| 2091 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | 2077 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); |
| 2092 | NSWindow *window = [view window]; | 2078 | EmacsWindow *window = (EmacsWindow *)[view window]; |
| 2093 | 2079 | ||
| 2094 | NSTRACE ("ns_set_appearance"); | 2080 | NSTRACE ("ns_set_appearance"); |
| 2095 | 2081 | ||
| @@ -2553,7 +2539,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2553 | id view; | 2539 | id view; |
| 2554 | NSPoint view_position; | 2540 | NSPoint view_position; |
| 2555 | Lisp_Object frame, tail; | 2541 | Lisp_Object frame, tail; |
| 2556 | struct frame *f; | 2542 | struct frame *f = NULL; |
| 2557 | struct ns_display_info *dpyinfo; | 2543 | struct ns_display_info *dpyinfo; |
| 2558 | 2544 | ||
| 2559 | NSTRACE ("ns_mouse_position"); | 2545 | NSTRACE ("ns_mouse_position"); |
| @@ -4005,7 +3991,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) | |||
| 4005 | { | 3991 | { |
| 4006 | NSRect r[2]; | 3992 | NSRect r[2]; |
| 4007 | NSRect glyphRect; | 3993 | NSRect glyphRect; |
| 4008 | int n, i; | 3994 | int n; |
| 4009 | struct face *face; | 3995 | struct face *face; |
| 4010 | NSColor *fgCol, *bgCol; | 3996 | NSColor *fgCol, *bgCol; |
| 4011 | 3997 | ||
| @@ -5389,7 +5375,7 @@ ns_term_init (Lisp_Object display_name) | |||
| 5389 | } | 5375 | } |
| 5390 | 5376 | ||
| 5391 | /* FIXME: Report any errors writing the color file below. */ | 5377 | /* FIXME: Report any errors writing the color file below. */ |
| 5392 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 | 5378 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 |
| 5393 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101100 | 5379 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 101100 |
| 5394 | if ([cl respondsToSelector:@selector(writeToURL:error:)]) | 5380 | if ([cl respondsToSelector:@selector(writeToURL:error:)]) |
| 5395 | #endif | 5381 | #endif |
| @@ -7395,7 +7381,7 @@ not_in_argv (NSString *arg) | |||
| 7395 | { | 7381 | { |
| 7396 | NSRect r, wr; | 7382 | NSRect r, wr; |
| 7397 | Lisp_Object tem; | 7383 | Lisp_Object tem; |
| 7398 | NSWindow *win; | 7384 | EmacsWindow *win; |
| 7399 | NSColor *col; | 7385 | NSColor *col; |
| 7400 | NSString *name; | 7386 | NSString *name; |
| 7401 | 7387 | ||
| @@ -8816,7 +8802,7 @@ not_in_argv (NSString *arg) | |||
| 8816 | 8802 | ||
| 8817 | - (void)setAppearance | 8803 | - (void)setAppearance |
| 8818 | { | 8804 | { |
| 8819 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 | 8805 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 |
| 8820 | struct frame *f = ((EmacsView *)[self delegate])->emacsframe; | 8806 | struct frame *f = ((EmacsView *)[self delegate])->emacsframe; |
| 8821 | NSAppearance *appearance = nil; | 8807 | NSAppearance *appearance = nil; |
| 8822 | 8808 | ||