]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug#56153
authorPo Lu <luangruo@yahoo.com>
Fri, 14 Oct 2022 11:04:44 +0000 (19:04 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 14 Oct 2022 11:04:44 +0000 (19:04 +0800)
* src/nsterm.m (get_keysym_name)
(ns_draw_glyphless_glyph_string_foreground): Fix new Mac OS
deprecations.

([EmacsApp terminate:]): Use kbd_buffer_store_event instead
of emacs_event.  (bug#56153)
([EmacsView windowDidChangeBackingProperties:]): Fix new Mac
OS deprecation.

src/nsterm.m

index 82fe58e90ec36223532b9e97f58dd9bc7bb17ec1..1fc72d83f66fe157685ea68d7548f381e2c5ca3b 100644 (file)
@@ -2479,7 +2479,7 @@ get_keysym_name (int keysym)
 {
   static char value[16];
   NSTRACE ("get_keysym_name");
-  sprintf (value, "%d", keysym);
+  snprintf (value, 16, "%d", keysym);
   return value;
 }
 
@@ -4263,7 +4263,7 @@ ns_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
        {
          unsigned int ch = glyph->u.glyphless.ch;
          eassume (ch <= MAX_CHAR);
-         sprintf (buf, "%0*X", ch < 0x10000 ? 4 : 6, ch);
+         snprintf (buf, 7, "%0*X", ch < 0x10000 ? 4 : 6, ch);
          str = buf;
        }
 
@@ -6116,17 +6116,20 @@ ns_term_shutdown (int sig)
 
 - (void) terminate: (id)sender
 {
+  struct input_event ie;
+  struct frame *f;
+
   NSTRACE ("[EmacsApp terminate:]");
 
-  struct frame *emacsframe = SELECTED_FRAME ();
+  f = SELECTED_FRAME ();
+  EVENT_INIT (ie);
 
-  if (!emacs_event)
-    return;
+  ie.kind = NS_NONKEY_EVENT;
+  ie.code = KEY_NS_POWER_OFF;
+  ie.arg = Qt; /* mark as non-key event */
+  XSETFRAME (ie.frame_or_window, f);
 
-  emacs_event->kind = NS_NONKEY_EVENT;
-  emacs_event->code = KEY_NS_POWER_OFF;
-  emacs_event->arg = Qt; /* mark as non-key event */
-  EV_TRAILER ((id)nil);
+  kbd_buffer_store_event (&ie);
 }
 
 static bool
@@ -8593,7 +8596,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
   EmacsLayer *layer = (EmacsLayer *)[self layer];
 
   [layer setContentsScale:[[notification object] backingScaleFactor]];
-  [layer setColorSpace:[[[notification object] colorSpace] CGColorSpace]];
+  [layer setColorSpace:[(id) [[notification object] colorSpace] CGColorSpace]];
 
   ns_clear_frame (emacsframe);
   expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));