aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Robert2009-01-25 19:43:31 +0000
committerAdrian Robert2009-01-25 19:43:31 +0000
commit8612b71a44b34519fe1b047a9f1d6f6b1431d411 (patch)
treecc7567046437fef05a5f60a93518c8c8a2b49bcc /src
parent0cb6149297b30250a6dc460ecb700a96bf576ea9 (diff)
downloademacs-8612b71a44b34519fe1b047a9f1d6f6b1431d411.tar.gz
emacs-8612b71a44b34519fe1b047a9f1d6f6b1431d411.zip
Changes to remove Feval calls from GUI under NS.
* nsterm.h: Move KEY_NS_... definitions here from nsterm.m. Add NS_TOGGLE_TOOLBAR, NS_PUT_WORKING_TEXT, NS_UNPUT_WORKING_TEXT. Remove NS_INSERT_WORKING_TEXT, NS_DELETE_WORKING_TEXT. * nsterm.m: Move KEY_NS_... definitions to nsterm.h. (EmacsView-toggleToolbar:): Use KEY_NS_TOGGLE_TOOLBAR. (EmacsView-setMarkedText:,-deleteWorkingText:): Use NS_TEXT_EVENT instead of NON_ASCII_KEYSTROKE_EVENT. (EmacsApp-terminate:): Use KEY_NS_POWER_OFF instead of Feval. (EmacsApp-applicationShouldTerminate:): Query user. (EmacsPreferencesController-runHelp:): Use KEY_NS_INFO_PREFS instead of Feval. * termhooks.h (NS_TEXT_EVENT): New event type under HAVE_NS. * keyboard.c (kbd_buffer_get_event): Check for it. (keys_of_keyboard): Define lispy keys for ns-put/unput-working-text. * nsmenu.m (ns_popup_dialog): Resync window setting with X and W32 versions. (EmacsDialog-runDialogAt:): Use NSModalPanelRunLoopMode.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog27
-rw-r--r--src/keyboard.c15
-rw-r--r--src/nsmenu.m22
-rw-r--r--src/nsterm.h16
-rw-r--r--src/nsterm.m158
-rw-r--r--src/termhooks.h7
6 files changed, 165 insertions, 80 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c3867a8de9b..f5b481d4f1e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,30 @@
12009-01-25 Adrian Robert <Adrian.B.Robert@gmail.com>
2
3 Changes to remove Feval calls from GUI under NS.
4
5 * nsterm.h: Move KEY_NS_... definitions here from nsterm.m. Add
6 NS_TOGGLE_TOOLBAR, NS_PUT_WORKING_TEXT, NS_UNPUT_WORKING_TEXT.
7 Remove NS_INSERT_WORKING_TEXT, NS_DELETE_WORKING_TEXT.
8
9 * nsterm.m: Move KEY_NS_... definitions to nsterm.h.
10 (EmacsView-toggleToolbar:): Use KEY_NS_TOGGLE_TOOLBAR.
11 (EmacsView-setMarkedText:,-deleteWorkingText:): Use NS_TEXT_EVENT
12 instead of NON_ASCII_KEYSTROKE_EVENT.
13 (EmacsApp-terminate:): Use KEY_NS_POWER_OFF instead of Feval.
14 (EmacsApp-applicationShouldTerminate:): Query user.
15 (EmacsPreferencesController-runHelp:): Use KEY_NS_INFO_PREFS
16 instead of Feval.
17
18 * termhooks.h (NS_TEXT_EVENT): New event type under HAVE_NS.
19
20 * keyboard.c (kbd_buffer_get_event): Check for it.
21 (keys_of_keyboard): Define lispy keys for
22 ns-put/unput-working-text.
23
24 * nsmenu.m (ns_popup_dialog): Resync window setting with X and W32
25 versions.
26 (EmacsDialog-runDialogAt:): Use NSModalPanelRunLoopMode.
27
12009-01-25 Chong Yidong <cyd@stupidchicken.com> 282009-01-25 Chong Yidong <cyd@stupidchicken.com>
2 29
3 * dispnew.c (buffer_posn_from_coords): Use Fset_buffer instead of 30 * dispnew.c (buffer_posn_from_coords): Use Fset_buffer instead of
diff --git a/src/keyboard.c b/src/keyboard.c
index a6be5b152db..cae40ffd85e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4113,6 +4113,17 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
4113#endif 4113#endif
4114 } 4114 }
4115 4115
4116#if defined (HAVE_NS)
4117 else if (event->kind == NS_TEXT_EVENT)
4118 {
4119 if (event->code == KEY_NS_PUT_WORKING_TEXT)
4120 obj = Fcons (intern ("ns-put-working-text"), Qnil);
4121 else
4122 obj = Fcons (intern ("ns-unput-working-text"), Qnil);
4123 kbd_fetch_ptr = event + 1;
4124 }
4125#endif
4126
4116#if defined (HAVE_X11) || defined (HAVE_NTGUI) \ 4127#if defined (HAVE_X11) || defined (HAVE_NTGUI) \
4117 || defined (HAVE_NS) 4128 || defined (HAVE_NS)
4118 else if (event->kind == DELETE_WINDOW_EVENT) 4129 else if (event->kind == DELETE_WINDOW_EVENT)
@@ -12382,6 +12393,10 @@ keys_of_keyboard ()
12382 12393
12383 initial_define_lispy_key (Vspecial_event_map, "delete-frame", 12394 initial_define_lispy_key (Vspecial_event_map, "delete-frame",
12384 "handle-delete-frame"); 12395 "handle-delete-frame");
12396 initial_define_lispy_key (Vspecial_event_map, "ns-put-working-text",
12397 "ns-put-working-text");
12398 initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
12399 "ns-unput-working-text");
12385 /* Here we used to use `ignore-event' which would simple set prefix-arg to 12400 /* Here we used to use `ignore-event' which would simple set prefix-arg to
12386 current-prefix-arg, as is done in `handle-switch-frame'. 12401 current-prefix-arg, as is done in `handle-switch-frame'.
12387 But `handle-switch-frame is not run from the special-map. 12402 But `handle-switch-frame is not run from the special-map.
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 94e8cb73fa8..b3c56809733 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1500,7 +1500,9 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1500 1500
1501 isQ = NILP (header); 1501 isQ = NILP (header);
1502 1502
1503 if (EQ (position, Qt)) 1503 if (EQ (position, Qt)
1504 || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar)
1505 || EQ (XCAR (position), Qtool_bar))))
1504 { 1506 {
1505 window = selected_window; 1507 window = selected_window;
1506 } 1508 }
@@ -1516,23 +1518,23 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1516 window = Fcar (tem); /* POSN_WINDOW (tem) */ 1518 window = Fcar (tem); /* POSN_WINDOW (tem) */
1517 } 1519 }
1518 } 1520 }
1519 else if (FRAMEP (position)) 1521 else if (WINDOWP (position) || FRAMEP (position))
1520 { 1522 {
1521 window = position; 1523 window = position;
1522 } 1524 }
1523 else 1525 else
1524 { 1526 window = Qnil;
1525 CHECK_LIVE_WINDOW (position); 1527
1526 window = position;
1527 }
1528
1529 if (FRAMEP (window)) 1528 if (FRAMEP (window))
1530 f = XFRAME (window); 1529 f = XFRAME (window);
1531 else 1530 else if (WINDOWP (window))
1532 { 1531 {
1533 CHECK_LIVE_WINDOW (window); 1532 CHECK_LIVE_WINDOW (window);
1534 f = XFRAME (WINDOW_FRAME (XWINDOW (window))); 1533 f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
1535 } 1534 }
1535 else
1536 CHECK_WINDOW (window);
1537
1536 p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2; 1538 p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2;
1537 p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2; 1539 p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2;
1538 dialog = [[EmacsDialogPanel alloc] initFromContents: contents 1540 dialog = [[EmacsDialogPanel alloc] initFromContents: contents
@@ -1860,9 +1862,9 @@ void process_dialog (id window, Lisp_Object list)
1860 { 1862 {
1861 (e = [NSApp nextEventMatchingMask: NSAnyEventMask 1863 (e = [NSApp nextEventMatchingMask: NSAnyEventMask
1862 untilDate: [NSDate distantFuture] 1864 untilDate: [NSDate distantFuture]
1863 inMode: NSEventTrackingRunLoopMode 1865 inMode: NSModalPanelRunLoopMode
1864 dequeue: NO]); 1866 dequeue: NO]);
1865/*fprintf (stderr, "ret = %d\te = %p\n", ret, e); */ 1867/*fprintf (stderr, "ret = %d\te = %p\n", ret, e);*/
1866 } 1868 }
1867 [NSApp endModalSession: session]; 1869 [NSApp endModalSession: session];
1868 1870
diff --git a/src/nsterm.h b/src/nsterm.h
index 781d312bafc..b1bff2e916f 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -384,6 +384,22 @@ typedef unsigned long NSUInteger;
384 384
385 ========================================================================== */ 385 ========================================================================== */
386 386
387/* Special keycodes that we pass down the event chain */
388#define KEY_NS_POWER_OFF ((1<<28)|(0<<16)|1)
389#define KEY_NS_OPEN_FILE ((1<<28)|(0<<16)|2)
390#define KEY_NS_OPEN_TEMP_FILE ((1<<28)|(0<<16)|3)
391#define KEY_NS_DRAG_FILE ((1<<28)|(0<<16)|4)
392#define KEY_NS_DRAG_COLOR ((1<<28)|(0<<16)|5)
393#define KEY_NS_DRAG_TEXT ((1<<28)|(0<<16)|6)
394#define KEY_NS_CHANGE_FONT ((1<<28)|(0<<16)|7)
395#define KEY_NS_OPEN_FILE_LINE ((1<<28)|(0<<16)|8)
396#define KEY_NS_PUT_WORKING_TEXT ((1<<28)|(0<<16)|9)
397#define KEY_NS_UNPUT_WORKING_TEXT ((1<<28)|(0<<16)|10)
398#define KEY_NS_SPI_SERVICE_CALL ((1<<28)|(0<<16)|11)
399#define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
400#define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13)
401#define KEY_NS_INFO_PREFS ((1<<28)|(0<<16)|14)
402
387/* could use list to store these, but rest of emacs has a big infrastructure 403/* could use list to store these, but rest of emacs has a big infrastructure
388 for managing a table of bitmap "records" */ 404 for managing a table of bitmap "records" */
389struct ns_bitmap_record 405struct ns_bitmap_record
diff --git a/src/nsterm.m b/src/nsterm.m
index 46bb50a91b6..91dd37e3043 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -69,20 +69,6 @@ int term_trace_num = 0;
69 69
70 ========================================================================== */ 70 ========================================================================== */
71 71
72/* Special keycodes that we pass down the event chain */
73#define KEY_NS_POWER_OFF ((1<<28)|(0<<16)|1)
74#define KEY_NS_OPEN_FILE ((1<<28)|(0<<16)|2)
75#define KEY_NS_OPEN_TEMP_FILE ((1<<28)|(0<<16)|3)
76#define KEY_NS_DRAG_FILE ((1<<28)|(0<<16)|4)
77#define KEY_NS_DRAG_COLOR ((1<<28)|(0<<16)|5)
78#define KEY_NS_DRAG_TEXT ((1<<28)|(0<<16)|6)
79#define KEY_NS_CHANGE_FONT ((1<<28)|(0<<16)|7)
80#define KEY_NS_OPEN_FILE_LINE ((1<<28)|(0<<16)|8)
81#define KEY_NS_INSERT_WORKING_TEXT ((1<<28)|(0<<16)|9)
82#define KEY_NS_DELETE_WORKING_TEXT ((1<<28)|(0<<16)|10)
83#define KEY_NS_SPI_SERVICE_CALL ((1<<28)|(0<<16)|11)
84#define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
85
86/* Convert a symbol indexed with an NSxxx value to a value as defined 72/* Convert a symbol indexed with an NSxxx value to a value as defined
87 in keyboard.c (lispy_function_key). I hope this is a correct way 73 in keyboard.c (lispy_function_key). I hope this is a correct way
88 of doing things... */ 74 of doing things... */
@@ -4048,7 +4034,7 @@ ns_term_shutdown (int sig)
4048 int type = [theEvent type]; 4034 int type = [theEvent type];
4049 NSWindow *window = [theEvent window]; 4035 NSWindow *window = [theEvent window];
4050/* NSTRACE (sendEvent); */ 4036/* NSTRACE (sendEvent); */
4051/*fprintf (stderr, "received event of type %d\n", [theEvent type]); */ 4037/*fprintf (stderr, "received event of type %d\t%d\n", type);*/
4052 4038
4053 if (type == NSCursorUpdate && window == nil) 4039 if (type == NSCursorUpdate && window == nil)
4054 { 4040 {
@@ -4153,37 +4139,79 @@ ns_term_shutdown (int sig)
4153} 4139}
4154 4140
4155 4141
4142/* Termination sequences (ns_shutdown_properly):
4143 C-x C-c:
4144 Cmd-Q:
4145 MenuBar | File | Exit:
4146 ns_term_shutdown: 0
4147 received -terminate: 1
4148 received -appShouldTerminate: 1
4149
4150 Select Quit from App menubar:
4151 received -terminate: 0
4152 ns_term_shutdown: 0
4153 received -terminate: 1
4154 received -appShouldTerminate: 1
4155
4156 Select Quit from Dock menu:
4157 Logout attempt:
4158 received -appShouldTerminate: 0
4159 Cancel -> Nothing else
4160 Accept ->
4161 received -terminate: 0
4162 ns_term_shutdown: 0
4163 received -terminate: 1
4164 received -appShouldTerminate: 1
4165*/
4166
4156- (void) terminate: (id)sender 4167- (void) terminate: (id)sender
4157{ 4168{
4158 BLOCK_INPUT;
4159 if (ns_shutdown_properly) 4169 if (ns_shutdown_properly)
4160 [super terminate: sender]; 4170 [super terminate: sender];
4161 else 4171 else
4162 { 4172 {
4163/* Fkill_emacs (Qnil); */ 4173 struct frame *emacsframe = SELECTED_FRAME ();
4174
4175 if (!emacs_event)
4176 return;
4177
4164 ns_shutdown_properly = YES; 4178 ns_shutdown_properly = YES;
4165 Feval (Fcons (intern ("save-buffers-kill-emacs"), Qnil)); 4179 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
4180 emacs_event->code = KEY_NS_POWER_OFF;
4181 EV_TRAILER ((id)nil);
4166 } 4182 }
4167 UNBLOCK_INPUT;
4168} 4183}
4169 4184
4170 4185
4171- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender 4186- (NSApplicationTerminateReply)applicationShouldTerminate: (id)sender
4172{ 4187{
4188 int ret;
4189
4173 if (ns_shutdown_properly) 4190 if (ns_shutdown_properly)
4174 return NSTerminateNow; 4191 return NSTerminateNow;
4175 4192
4176 Lisp_Object contents = list3 (build_string ("Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?"), 4193 /* XXX: This while() loop is needed because if the user switches to another
4177 Fcons (build_string ("Cancel"), Qnil), 4194 application while the panel is up, it is taken down w/a return value
4178 Fcons (build_string ("Save and Exit"), Qt)); 4195 of -1000, and the event queue gets messed up. In this case resend
4179 Lisp_Object res = ns_popup_dialog (Qt, contents, Qnil); 4196 the appdefined and put up the window again. */
4180fprintf (stderr, "res = %d\n", EQ (res, Qt)); /* FIXME */ 4197 while (1) {
4181 if (EQ (res, Qt)) 4198 ret = NSRunAlertPanel([[NSProcessInfo processInfo] processName],
4182 { 4199 [NSString stringWithUTF8String:"Exit requested. Would you like to Save Buffers and Exit, or Cancel the request?"],
4183 Feval (Fcons (intern ("save-buffers-kill-emacs"), Qnil)); 4200 @"Save Buffers and Exit", @"Cancel", nil);
4184 return NSTerminateNow; 4201
4185 } 4202 if (ret == NSAlertDefaultReturn)
4186 return NSTerminateCancel; 4203 {
4204 send_appdefined = YES;
4205 ns_send_appdefined(-1);
4206 return NSTerminateNow;
4207 }
4208 else if (ret == NSAlertAlternateReturn)
4209 {
4210 send_appdefined = YES;
4211 ns_send_appdefined(-1);
4212 return NSTerminateCancel;
4213 }
4214 }
4187} 4215}
4188 4216
4189 4217
@@ -4612,7 +4640,9 @@ extern void update_window_cursor (struct window *w, int on);
4612/* <NSTextInput> implementation (called through super interpretKeyEvents:]). */ 4640/* <NSTextInput> implementation (called through super interpretKeyEvents:]). */
4613 4641
4614 4642
4615/* <NSTextInput>: called through when done composing */ 4643/* <NSTextInput>: called when done composing;
4644 NOTE: also called when we delete over working text, followed immed.
4645 by doCommandBySelector: deleteBackward: */
4616- (void)insertText: (id)aString 4646- (void)insertText: (id)aString
4617{ 4647{
4618 int code; 4648 int code;
@@ -4667,20 +4697,9 @@ extern void update_window_cursor (struct window *w, int on);
4667 workingText = [str copy]; 4697 workingText = [str copy];
4668 ns_working_text = build_string ([workingText UTF8String]); 4698 ns_working_text = build_string ([workingText UTF8String]);
4669 4699
4670 /* if in "echo area", not true minibuffer, can't show chars in interactive 4700 emacs_event->kind = NS_TEXT_EVENT;
4671 mode, so call using eval; otherwise we send a key event, which was the 4701 emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
4672 original way this was done */ 4702 EV_TRAILER ((id)nil);
4673 if (!EQ (Feval (Fcons (intern ("ns-in-echo-area"), Qnil)), Qnil))
4674 {
4675 Feval (Fcons (intern ("ns-echo-working-text"), Qnil));
4676 ns_send_appdefined (-1);
4677 }
4678 else
4679 {
4680 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
4681 emacs_event->code = KEY_NS_INSERT_WORKING_TEXT;
4682 EV_TRAILER ((id)nil);
4683 }
4684} 4703}
4685 4704
4686 4705
@@ -4690,7 +4709,7 @@ extern void update_window_cursor (struct window *w, int on);
4690 if (workingText == nil) 4709 if (workingText == nil)
4691 return; 4710 return;
4692 if (NS_KEYLOG) 4711 if (NS_KEYLOG)
4693 fprintf (stderr, "deleteWorkingText len =%d\n", [workingText length]); 4712 NSLog(@"deleteWorkingText len =%d\n", [workingText length]);
4694 [workingText release]; 4713 [workingText release];
4695 workingText = nil; 4714 workingText = nil;
4696 processingCompose = NO; 4715 processingCompose = NO;
@@ -4698,18 +4717,10 @@ extern void update_window_cursor (struct window *w, int on);
4698 if (!emacs_event) 4717 if (!emacs_event)
4699 return; 4718 return;
4700 4719
4701 if (!EQ (Feval (Fcons (intern ("ns-in-echo-area"), Qnil)), Qnil)) 4720 emacs_event->kind = NS_TEXT_EVENT;
4702 { 4721 emacs_event->code = KEY_NS_UNPUT_WORKING_TEXT;
4703 Feval (Fcons (intern ("ns-unecho-working-text"), Qnil)); 4722 EV_TRAILER ((id)nil);
4704 ns_send_appdefined (-1); 4723}
4705 }
4706 else
4707 {
4708 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
4709 emacs_event->code = KEY_NS_DELETE_WORKING_TEXT;
4710 EV_TRAILER ((id)nil);
4711 }
4712 }
4713 4724
4714 4725
4715- (BOOL)hasMarkedText 4726- (BOOL)hasMarkedText
@@ -4717,6 +4728,7 @@ extern void update_window_cursor (struct window *w, int on);
4717 return workingText != nil; 4728 return workingText != nil;
4718} 4729}
4719 4730
4731
4720- (NSRange)markedRange 4732- (NSRange)markedRange
4721{ 4733{
4722 NSRange rng = workingText != nil 4734 NSRange rng = workingText != nil
@@ -4726,6 +4738,7 @@ extern void update_window_cursor (struct window *w, int on);
4726 return rng; 4738 return rng;
4727} 4739}
4728 4740
4741
4729- (void)unmarkText 4742- (void)unmarkText
4730{ 4743{
4731 if (NS_KEYLOG) 4744 if (NS_KEYLOG)
@@ -4734,6 +4747,7 @@ extern void update_window_cursor (struct window *w, int on);
4734 processingCompose = NO; 4747 processingCompose = NO;
4735} 4748}
4736 4749
4750
4737/* used to position char selection windows, etc. */ 4751/* used to position char selection windows, etc. */
4738- (NSRect)firstRectForCharacterRange: (NSRange)theRange 4752- (NSRect)firstRectForCharacterRange: (NSRange)theRange
4739{ 4753{
@@ -4755,12 +4769,12 @@ extern void update_window_cursor (struct window *w, int on);
4755 return rect; 4769 return rect;
4756} 4770}
4757 4771
4772
4758- (NSInteger)conversationIdentifier 4773- (NSInteger)conversationIdentifier
4759{ 4774{
4760 return (NSInteger)self; 4775 return (NSInteger)self;
4761} 4776}
4762 4777
4763/* TODO: below here not yet implemented correctly, but may not be needed */
4764 4778
4765- (void)doCommandBySelector: (SEL)aSelector 4779- (void)doCommandBySelector: (SEL)aSelector
4766{ 4780{
@@ -5398,7 +5412,7 @@ extern void update_window_cursor (struct window *w, int on);
5398 return self; 5412 return self;
5399 5413
5400 /* send first event (for some reason two needed) */ 5414 /* send first event (for some reason two needed) */
5401 theEvent =[[self window] currentEvent]; 5415 theEvent = [[self window] currentEvent];
5402 emacs_event->kind = TOOL_BAR_EVENT; 5416 emacs_event->kind = TOOL_BAR_EVENT;
5403 XSETFRAME (emacs_event->arg, emacsframe); 5417 XSETFRAME (emacs_event->arg, emacsframe);
5404 EV_TRAILER (theEvent); 5418 EV_TRAILER (theEvent);
@@ -5415,11 +5429,13 @@ extern void update_window_cursor (struct window *w, int on);
5415 5429
5416- toggleToolbar: (id)sender 5430- toggleToolbar: (id)sender
5417{ 5431{
5418 Lisp_Object lispFrame; 5432 if (!emacs_event)
5419 XSETFRAME (lispFrame, emacsframe); 5433 return self;
5420 Feval (Fcons (intern ("ns-toggle-toolbar"), Fcons (lispFrame, Qnil))); 5434
5421 SET_FRAME_GARBAGED (emacsframe); 5435 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
5422 ns_send_appdefined (-1); 5436 emacs_event->code = KEY_NS_TOGGLE_TOOLBAR;
5437 EV_TRAILER ((id)nil);
5438 return self;
5423} 5439}
5424 5440
5425 5441
@@ -6266,11 +6282,13 @@ static void selectItemWithTag (NSPopUpButton *popup, int tag)
6266 6282
6267- (IBAction)runHelp: (id)sender 6283- (IBAction)runHelp: (id)sender
6268{ 6284{
6269 Feval (Fcons (intern ("info"), 6285 struct frame *emacsframe = frame;
6270 Fcons (build_string ("(emacs)Mac / GNUstep Customization"), 6286 if (!emacs_event)
6271 Qnil))); 6287 return;
6272 SET_FRAME_GARBAGED (frame); 6288 ns_raise_frame(frame);
6273 ns_send_appdefined (-1); 6289 emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
6290 emacs_event->code = KEY_NS_INFO_PREFS;
6291 EV_TRAILER ((id)nil);
6274} 6292}
6275 6293
6276 6294
diff --git a/src/termhooks.h b/src/termhooks.h
index ed15b0f71cf..5dedd487a2a 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -198,6 +198,13 @@ enum event_kind
198 first, so this is not a problem there. */ 198 first, so this is not a problem there. */
199 , MULTIMEDIA_KEY_EVENT 199 , MULTIMEDIA_KEY_EVENT
200#endif 200#endif
201
202#ifdef HAVE_NS
203 /* Generated when native multi-keystroke input method is used to modify
204 tentative or indicative text display. */
205 , NS_TEXT_EVENT
206#endif
207
201}; 208};
202 209
203/* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT 210/* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT