diff options
| author | Adrian Robert | 2008-07-15 18:15:18 +0000 |
|---|---|---|
| committer | Adrian Robert | 2008-07-15 18:15:18 +0000 |
| commit | edfda78355c5528eee489fa8a7f9c73bf8e734f2 (patch) | |
| tree | 78d2414d9791e1efc17ec9b35b438ae35602340a /src/keyboard.c | |
| parent | 1391cd548782097e34d7856ec4f20ca90bdf2c26 (diff) | |
| download | emacs-edfda78355c5528eee489fa8a7f9c73bf8e734f2.tar.gz emacs-edfda78355c5528eee489fa8a7f9c73bf8e734f2.zip | |
merging Emacs.app (NeXTstep port)
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index e42e17525e6..b908b8ad349 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -80,6 +80,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 80 | #include "macterm.h" | 80 | #include "macterm.h" |
| 81 | #endif | 81 | #endif |
| 82 | 82 | ||
| 83 | #ifdef HAVE_NS | ||
| 84 | #include "nsterm.h" | ||
| 85 | extern Lisp_Object Qsuper; | ||
| 86 | #endif | ||
| 87 | |||
| 83 | #ifndef USE_CRT_DLL | 88 | #ifndef USE_CRT_DLL |
| 84 | extern int errno; | 89 | extern int errno; |
| 85 | #endif | 90 | #endif |
| @@ -4147,7 +4152,8 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) | |||
| 4147 | #endif | 4152 | #endif |
| 4148 | } | 4153 | } |
| 4149 | 4154 | ||
| 4150 | #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) | 4155 | #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) \ |
| 4156 | || defined (HAVE_NS) | ||
| 4151 | else if (event->kind == DELETE_WINDOW_EVENT) | 4157 | else if (event->kind == DELETE_WINDOW_EVENT) |
| 4152 | { | 4158 | { |
| 4153 | /* Make an event (delete-frame (FRAME)). */ | 4159 | /* Make an event (delete-frame (FRAME)). */ |
| @@ -4156,7 +4162,8 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) | |||
| 4156 | kbd_fetch_ptr = event + 1; | 4162 | kbd_fetch_ptr = event + 1; |
| 4157 | } | 4163 | } |
| 4158 | #endif | 4164 | #endif |
| 4159 | #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) | 4165 | #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) \ |
| 4166 | || defined (HAVE_NS) | ||
| 4160 | else if (event->kind == ICONIFY_EVENT) | 4167 | else if (event->kind == ICONIFY_EVENT) |
| 4161 | { | 4168 | { |
| 4162 | /* Make an event (iconify-frame (FRAME)). */ | 4169 | /* Make an event (iconify-frame (FRAME)). */ |
| @@ -4179,7 +4186,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) | |||
| 4179 | kbd_fetch_ptr = event + 1; | 4186 | kbd_fetch_ptr = event + 1; |
| 4180 | } | 4187 | } |
| 4181 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ | 4188 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ |
| 4182 | || defined (USE_GTK) | 4189 | || defined(HAVE_NS) || defined (USE_GTK) |
| 4183 | else if (event->kind == MENU_BAR_ACTIVATE_EVENT) | 4190 | else if (event->kind == MENU_BAR_ACTIVATE_EVENT) |
| 4184 | { | 4191 | { |
| 4185 | kbd_fetch_ptr = event + 1; | 4192 | kbd_fetch_ptr = event + 1; |
| @@ -4289,7 +4296,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) | |||
| 4289 | obj = make_lispy_event (event); | 4296 | obj = make_lispy_event (event); |
| 4290 | 4297 | ||
| 4291 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined(MAC_OS) \ | 4298 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined(MAC_OS) \ |
| 4292 | || defined (USE_GTK) | 4299 | || defined(HAVE_NS) || defined (USE_GTK) |
| 4293 | /* If this was a menu selection, then set the flag to inhibit | 4300 | /* If this was a menu selection, then set the flag to inhibit |
| 4294 | writing to last_nonmenu_event. Don't do this if the event | 4301 | writing to last_nonmenu_event. Don't do this if the event |
| 4295 | we're returning is (menu-bar), though; that indicates the | 4302 | we're returning is (menu-bar), though; that indicates the |
| @@ -5643,7 +5650,7 @@ make_lispy_event (event) | |||
| 5643 | if (event->kind == MOUSE_CLICK_EVENT) | 5650 | if (event->kind == MOUSE_CLICK_EVENT) |
| 5644 | { | 5651 | { |
| 5645 | struct frame *f = XFRAME (event->frame_or_window); | 5652 | struct frame *f = XFRAME (event->frame_or_window); |
| 5646 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) | 5653 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) && ! defined (HAVE_NS) |
| 5647 | int row, column; | 5654 | int row, column; |
| 5648 | #endif | 5655 | #endif |
| 5649 | 5656 | ||
| @@ -5652,7 +5659,7 @@ make_lispy_event (event) | |||
| 5652 | if (! FRAME_LIVE_P (f)) | 5659 | if (! FRAME_LIVE_P (f)) |
| 5653 | return Qnil; | 5660 | return Qnil; |
| 5654 | 5661 | ||
| 5655 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) | 5662 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) && ! defined (HAVE_NS) |
| 5656 | /* EVENT->x and EVENT->y are frame-relative pixel | 5663 | /* EVENT->x and EVENT->y are frame-relative pixel |
| 5657 | coordinates at this place. Under old redisplay, COLUMN | 5664 | coordinates at this place. Under old redisplay, COLUMN |
| 5658 | and ROW are set to frame relative glyph coordinates | 5665 | and ROW are set to frame relative glyph coordinates |
| @@ -5712,7 +5719,7 @@ make_lispy_event (event) | |||
| 5712 | 5719 | ||
| 5713 | return Fcons (item, Fcons (position, Qnil)); | 5720 | return Fcons (item, Fcons (position, Qnil)); |
| 5714 | } | 5721 | } |
| 5715 | #endif /* not USE_X_TOOLKIT && not USE_GTK */ | 5722 | #endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ |
| 5716 | 5723 | ||
| 5717 | position = make_lispy_position (f, &event->x, &event->y, | 5724 | position = make_lispy_position (f, &event->x, &event->y, |
| 5718 | event->timestamp); | 5725 | event->timestamp); |
| @@ -6092,7 +6099,7 @@ make_lispy_event (event) | |||
| 6092 | #endif /* HAVE_MOUSE */ | 6099 | #endif /* HAVE_MOUSE */ |
| 6093 | 6100 | ||
| 6094 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ | 6101 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ |
| 6095 | || defined (USE_GTK) | 6102 | || defined(HAVE_NS) || defined (USE_GTK) |
| 6096 | case MENU_BAR_EVENT: | 6103 | case MENU_BAR_EVENT: |
| 6097 | if (EQ (event->arg, event->frame_or_window)) | 6104 | if (EQ (event->arg, event->frame_or_window)) |
| 6098 | /* This is the prefix key. We translate this to | 6105 | /* This is the prefix key. We translate this to |
| @@ -7305,6 +7312,10 @@ tty_read_avail_input (struct terminal *terminal, | |||
| 7305 | void | 7312 | void |
| 7306 | handle_async_input () | 7313 | handle_async_input () |
| 7307 | { | 7314 | { |
| 7315 | #ifdef BSD4_1 | ||
| 7316 | extern int select_alarmed; | ||
| 7317 | #endif | ||
| 7318 | |||
| 7308 | interrupt_input_pending = 0; | 7319 | interrupt_input_pending = 0; |
| 7309 | 7320 | ||
| 7310 | while (1) | 7321 | while (1) |
| @@ -7317,6 +7328,9 @@ handle_async_input () | |||
| 7317 | if (nread <= 0) | 7328 | if (nread <= 0) |
| 7318 | break; | 7329 | break; |
| 7319 | 7330 | ||
| 7331 | #ifdef BSD4_1 | ||
| 7332 | select_alarmed = 1; /* Force the select emulator back to life */ | ||
| 7333 | #endif | ||
| 7320 | } | 7334 | } |
| 7321 | } | 7335 | } |
| 7322 | 7336 | ||
| @@ -7335,6 +7349,10 @@ input_available_signal (signo) | |||
| 7335 | signal (signo, input_available_signal); | 7349 | signal (signo, input_available_signal); |
| 7336 | #endif /* USG */ | 7350 | #endif /* USG */ |
| 7337 | 7351 | ||
| 7352 | #ifdef BSD4_1 | ||
| 7353 | sigisheld (SIGIO); | ||
| 7354 | #endif | ||
| 7355 | |||
| 7338 | #ifdef SYNC_INPUT | 7356 | #ifdef SYNC_INPUT |
| 7339 | interrupt_input_pending = 1; | 7357 | interrupt_input_pending = 1; |
| 7340 | #else | 7358 | #else |
| @@ -7348,6 +7366,9 @@ input_available_signal (signo) | |||
| 7348 | handle_async_input (); | 7366 | handle_async_input (); |
| 7349 | #endif | 7367 | #endif |
| 7350 | 7368 | ||
| 7369 | #ifdef BSD4_1 | ||
| 7370 | sigfree (); | ||
| 7371 | #endif | ||
| 7351 | errno = old_errno; | 7372 | errno = old_errno; |
| 7352 | } | 7373 | } |
| 7353 | #endif /* SIGIO */ | 7374 | #endif /* SIGIO */ |
| @@ -7975,10 +7996,15 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 7975 | /* With the introduction of where_is_cache, the computation | 7996 | /* With the introduction of where_is_cache, the computation |
| 7976 | of equivalent key bindings is sufficiently fast that we | 7997 | of equivalent key bindings is sufficiently fast that we |
| 7977 | do not need to cache it here any more. */ | 7998 | do not need to cache it here any more. */ |
| 7978 | /* CHECK_IMPURE (start); | 7999 | /*PENDING: under NS this effect does not hold, perhaps due to the |
| 7979 | XSETCDR (start, Fcons (Fcons (Qnil, Qnil), XCDR (start))); | 8000 | modifier-preference changes to where-is-internal.. */ |
| 7980 | cachelist = XCAR (XCDR (start)); */ | 8001 | #ifdef HAVE_NS |
| 8002 | CHECK_IMPURE (start); | ||
| 8003 | XSETCDR (start, Fcons (Fcons (Qnil, Qnil), XCDR (start))); | ||
| 8004 | cachelist = XCAR (XCDR (start)); | ||
| 8005 | #else | ||
| 7981 | cachelist = Fcons (Qnil, Qnil); | 8006 | cachelist = Fcons (Qnil, Qnil); |
| 8007 | #endif | ||
| 7982 | newcache = 1; | 8008 | newcache = 1; |
| 7983 | tem = AREF (item_properties, ITEM_PROPERTY_KEYEQ); | 8009 | tem = AREF (item_properties, ITEM_PROPERTY_KEYEQ); |
| 7984 | if (!NILP (keyhint)) | 8010 | if (!NILP (keyhint)) |
| @@ -8044,7 +8070,12 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 8044 | && SYMBOLP (XSYMBOL (def)->function) | 8070 | && SYMBOLP (XSYMBOL (def)->function) |
| 8045 | && ! NILP (Fget (def, Qmenu_alias))) | 8071 | && ! NILP (Fget (def, Qmenu_alias))) |
| 8046 | def = XSYMBOL (def)->function; | 8072 | def = XSYMBOL (def)->function; |
| 8073 | #ifdef HAVE_NS | ||
| 8074 | /* prefer 'super' bindings */ | ||
| 8075 | tem = Fwhere_is_internal (def, Qnil, Qsuper, Qt, Qt); | ||
| 8076 | #else | ||
| 8047 | tem = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qt); | 8077 | tem = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qt); |
| 8078 | #endif | ||
| 8048 | XSETCAR (cachelist, tem); | 8079 | XSETCAR (cachelist, tem); |
| 8049 | if (NILP (tem)) | 8080 | if (NILP (tem)) |
| 8050 | { | 8081 | { |
| @@ -8077,7 +8108,7 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 8077 | if (newcache && !NILP (tem)) | 8108 | if (newcache && !NILP (tem)) |
| 8078 | { | 8109 | { |
| 8079 | tem = concat2 (build_string (" "), tem); | 8110 | tem = concat2 (build_string (" "), tem); |
| 8080 | // tem = concat3 (build_string (" ("), tem, build_string (")")); | 8111 | /* tem = concat3 (build_string (" ("), tem, build_string (")")); */ |
| 8081 | XSETCDR (cachelist, tem); | 8112 | XSETCDR (cachelist, tem); |
| 8082 | } | 8113 | } |
| 8083 | 8114 | ||