aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-02-20 20:00:28 +0800
committerPo Lu2022-02-20 20:00:28 +0800
commit7a6e229a2e7eeb57a3dd00295bf1d0e76c092e9e (patch)
tree421c2e23d3c2d2e45da6b64ad932967fb041cc00 /src
parent7b7c09c5612b20c277ae5b78514858e9805c3f35 (diff)
downloademacs-7a6e229a2e7eeb57a3dd00295bf1d0e76c092e9e.tar.gz
emacs-7a6e229a2e7eeb57a3dd00295bf1d0e76c092e9e.zip
Fix font panel on NS
* src/nsterm.m ([EmacsView changeFont:]): Don't use emacs_event, instead placing events directly into the keyboard buffer.
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 1d7788e3e56..aba26ef7585 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5974,17 +5974,15 @@ not_in_argv (NSString *arg)
5974/* Called on font panel selection. */ 5974/* Called on font panel selection. */
5975- (void)changeFont: (id)sender 5975- (void)changeFont: (id)sender
5976{ 5976{
5977 NSEvent *e = [[self window] currentEvent];
5978 struct face *face = FACE_FROM_ID (emacsframe, DEFAULT_FACE_ID); 5977 struct face *face = FACE_FROM_ID (emacsframe, DEFAULT_FACE_ID);
5979 struct font *font = face->font; 5978 struct font *font = face->font;
5980 id newFont; 5979 id newFont;
5981 CGFloat size; 5980 CGFloat size;
5982 NSFont *nsfont; 5981 NSFont *nsfont;
5982 struct input_event ie;
5983 5983
5984 NSTRACE ("[EmacsView changeFont:]"); 5984 NSTRACE ("[EmacsView changeFont:]");
5985 5985 EVENT_INIT (ie);
5986 if (!emacs_event)
5987 return;
5988 5986
5989#ifdef NS_IMPL_GNUSTEP 5987#ifdef NS_IMPL_GNUSTEP
5990 nsfont = ((struct nsfont_info *)font)->nsfont; 5988 nsfont = ((struct nsfont_info *)font)->nsfont;
@@ -5995,16 +5993,16 @@ not_in_argv (NSString *arg)
5995 5993
5996 if ((newFont = [sender convertFont: nsfont])) 5994 if ((newFont = [sender convertFont: nsfont]))
5997 { 5995 {
5998 SET_FRAME_GARBAGED (emacsframe); /* now needed as of 2008/10 */ 5996 ie.kind = NS_NONKEY_EVENT;
5999 5997 ie.modifiers = 0;
6000 emacs_event->kind = NS_NONKEY_EVENT; 5998 ie.code = KEY_NS_CHANGE_FONT;
6001 emacs_event->modifiers = 0; 5999 XSETFRAME (ie.frame_or_window, emacsframe);
6002 emacs_event->code = KEY_NS_CHANGE_FONT;
6003 6000
6004 size = [newFont pointSize]; 6001 size = [newFont pointSize];
6005 ns_input_fontsize = make_fixnum (lrint (size)); 6002 ns_input_fontsize = make_fixnum (lrint (size));
6006 ns_input_font = [[newFont familyName] lispString]; 6003 ns_input_font = [[newFont familyName] lispString];
6007 EV_TRAILER (e); 6004
6005 kbd_buffer_store_event (&ie);
6008 } 6006 }
6009} 6007}
6010 6008