diff options
| author | Alan Third <alan@idiocy.org> | 2020-03-02 17:54:32 +0000 | 
|---|---|---|
| committer | Alan Third <alan@idiocy.org> | 2020-03-02 18:30:44 +0000 | 
| commit | b4911a6f0da0bfae3832b3aa0c111db4bb2f49d5 (patch) | |
| tree | 7c909d1bcc75f7ecb8bacd81d8a04648f7c8902c | |
| parent | 68109c56e45ff531934bfe81f9bd14a530a35574 (diff) | |
| download | emacs-b4911a6f0da0bfae3832b3aa0c111db4bb2f49d5.tar.gz | |
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.
| -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)    if (! (lc_all && strcmp (lc_all, "C") == 0))      {        #ifdef HAVE_NS +        ns_pool = ns_alloc_autorelease_pool ();          ns_init_locale ();        #endif        setlocale (LC_ALL, ""); @@ -1612,8 +1613,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem  #endif  #ifdef HAVE_NS -  ns_pool = ns_alloc_autorelease_pool (); -    if (!noninteractive)      {  #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",     ========================================================================== */ -/* -  Handle arrow/function/control keys and copy/paste/cut in file dialogs. -  Return YES if handled, NO if not. - */ -static BOOL -handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent) -{ -  NSString *s; -  int i; -  BOOL ret = NO; - -  if ([theEvent type] != NSEventTypeKeyDown) return NO; -  s = [theEvent characters]; - -  for (i = 0; i < [s length]; ++i) -    { -      int ch = (int) [s characterAtIndex: i]; -      switch (ch) -        { -        case NSHomeFunctionKey: -        case NSDownArrowFunctionKey: -        case NSUpArrowFunctionKey: -        case NSLeftArrowFunctionKey: -        case NSRightArrowFunctionKey: -        case NSPageUpFunctionKey: -        case NSPageDownFunctionKey: -        case NSEndFunctionKey: -          /* Don't send command modified keys, as those are handled in the -             performKeyEquivalent method of the super class.  */ -          if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand)) -            { -              [panel sendEvent: theEvent]; -              ret = YES; -            } -          break; -          /* As we don't have the standard key commands for -             copy/paste/cut/select-all in our edit menu, we must handle -             them here.  TODO: handle Emacs key bindings for copy/cut/select-all -             here, paste works, because we have that in our Edit menu. -             I.e. refactor out code in nsterm.m, keyDown: to figure out the -             correct modifier.  */ -        case 'x': // Cut -        case 'c': // Copy -        case 'v': // Paste -        case 'a': // Select all -          if ([theEvent modifierFlags] & NSEventModifierFlagCommand) -            { -              [NSApp sendAction: -                       (ch == 'x' -                        ? @selector(cut:) -                        : (ch == 'c' -                           ? @selector(copy:) -                           : (ch == 'v' -                              ? @selector(paste:) -                              : @selector(selectAll:)))) -                             to:nil from:panel]; -              ret = YES; -            } -        default: -          // Send all control keys, as the text field supports C-a, C-f, C-e -          // C-b and more. -          if ([theEvent modifierFlags] & NSEventModifierFlagControl) -            { -              [panel sendEvent: theEvent]; -              ret = YES; -            } -          break; -        } -    } - - -  return ret; -} -  @implementation EmacsFileDelegate  /* --------------------------------------------------------------------------     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)  } -static void -ns_clip_to_row (struct window *w, struct glyph_row *row, -		enum glyph_row_area area, BOOL gc) -/* -------------------------------------------------------------------------- -     Internal (but parallels other terms): Focus drawing on given row -   -------------------------------------------------------------------------- */ -{ -  struct frame *f = XFRAME (WINDOW_FRAME (w)); -  NSRect clip_rect = ns_row_rect (w, row, area); - -  ns_focus (f, &clip_rect, 1); -} - -  /* ==========================================================================      Visible bell and beep. @@ -2089,7 +2075,7 @@ ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value  {  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000    EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); -  NSWindow *window = [view window]; +  EmacsWindow *window = (EmacsWindow *)[view window];    NSTRACE ("ns_set_appearance"); @@ -2553,7 +2539,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,    id view;    NSPoint view_position;    Lisp_Object frame, tail; -  struct frame *f; +  struct frame *f = NULL;    struct ns_display_info *dpyinfo;    NSTRACE ("ns_mouse_position"); @@ -4005,7 +3991,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s)  {    NSRect r[2];    NSRect glyphRect; -  int n, i; +  int n;    struct face *face;    NSColor *fgCol, *bgCol; @@ -5389,7 +5375,7 @@ ns_term_init (Lisp_Object display_name)            }          /* FIXME: Report any errors writing the color file below.  */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101100  #if MAC_OS_X_VERSION_MIN_REQUIRED < 101100          if ([cl respondsToSelector:@selector(writeToURL:error:)])  #endif @@ -7395,7 +7381,7 @@ not_in_argv (NSString *arg)  {    NSRect r, wr;    Lisp_Object tem; -  NSWindow *win; +  EmacsWindow *win;    NSColor *col;    NSString *name; @@ -8816,7 +8802,7 @@ not_in_argv (NSString *arg)  - (void)setAppearance  { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000    struct frame *f = ((EmacsView *)[self delegate])->emacsframe;    NSAppearance *appearance = nil; | 
