]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix font panel on NS
authorPo Lu <luangruo@yahoo.com>
Sun, 20 Feb 2022 12:00:28 +0000 (20:00 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 20 Feb 2022 12:00:28 +0000 (20:00 +0800)
* src/nsterm.m ([EmacsView changeFont:]): Don't use emacs_event,
instead placing events directly into the keyboard buffer.

src/nsterm.m

index 1d7788e3e56e5f49fb0fa3a69ee0262ce6c207f7..aba26ef7585f4d125e0e8205df1b19c7dd2a9b7a 100644 (file)
@@ -5974,17 +5974,15 @@ not_in_argv (NSString *arg)
 /* Called on font panel selection.  */
 - (void)changeFont: (id)sender
 {
-  NSEvent *e = [[self window] currentEvent];
   struct face *face = FACE_FROM_ID (emacsframe, DEFAULT_FACE_ID);
   struct font *font = face->font;
   id newFont;
   CGFloat size;
   NSFont *nsfont;
+  struct input_event ie;
 
   NSTRACE ("[EmacsView changeFont:]");
-
-  if (!emacs_event)
-    return;
+  EVENT_INIT (ie);
 
 #ifdef NS_IMPL_GNUSTEP
   nsfont = ((struct nsfont_info *)font)->nsfont;
@@ -5995,16 +5993,16 @@ not_in_argv (NSString *arg)
 
   if ((newFont = [sender convertFont: nsfont]))
     {
-      SET_FRAME_GARBAGED (emacsframe); /* now needed as of 2008/10 */
-
-      emacs_event->kind = NS_NONKEY_EVENT;
-      emacs_event->modifiers = 0;
-      emacs_event->code = KEY_NS_CHANGE_FONT;
+      ie.kind = NS_NONKEY_EVENT;
+      ie.modifiers = 0;
+      ie.code = KEY_NS_CHANGE_FONT;
+      XSETFRAME (ie.frame_or_window, emacsframe);
 
       size = [newFont pointSize];
       ns_input_fontsize = make_fixnum (lrint (size));
       ns_input_font = [[newFont familyName] lispString];
-      EV_TRAILER (e);
+
+      kbd_buffer_store_event (&ie);
     }
 }