X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/08861c5cb87e91e83e5b0bf53cb53c1377434c8f..edfda78355c5528eee489fa8a7f9c73bf8e734f2:/src/keyboard.c diff --git a/src/keyboard.c b/src/keyboard.c index 6e7bcca3ca..b908b8ad34 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5,10 +5,10 @@ This file is part of GNU Emacs. -GNU Emacs is free software; you can redistribute it and/or modify +GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ +along with GNU Emacs. If not, see . */ #include #include @@ -82,6 +80,11 @@ Boston, MA 02110-1301, USA. */ #include "macterm.h" #endif +#ifdef HAVE_NS +#include "nsterm.h" +extern Lisp_Object Qsuper; +#endif + #ifndef USE_CRT_DLL extern int errno; #endif @@ -4149,7 +4152,8 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) #endif } -#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) +#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) \ + || defined (HAVE_NS) else if (event->kind == DELETE_WINDOW_EVENT) { /* Make an event (delete-frame (FRAME)). */ @@ -4158,7 +4162,8 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) kbd_fetch_ptr = event + 1; } #endif -#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) +#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) \ + || defined (HAVE_NS) else if (event->kind == ICONIFY_EVENT) { /* Make an event (iconify-frame (FRAME)). */ @@ -4181,7 +4186,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) kbd_fetch_ptr = event + 1; } #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined(HAVE_NS) || defined (USE_GTK) else if (event->kind == MENU_BAR_ACTIVATE_EVENT) { kbd_fetch_ptr = event + 1; @@ -4291,7 +4296,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time) obj = make_lispy_event (event); #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined(MAC_OS) \ - || defined (USE_GTK) + || defined(HAVE_NS) || defined (USE_GTK) /* If this was a menu selection, then set the flag to inhibit writing to last_nonmenu_event. Don't do this if the event we're returning is (menu-bar), though; that indicates the @@ -5645,7 +5650,7 @@ make_lispy_event (event) if (event->kind == MOUSE_CLICK_EVENT) { struct frame *f = XFRAME (event->frame_or_window); -#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) +#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) && ! defined (HAVE_NS) int row, column; #endif @@ -5654,7 +5659,7 @@ make_lispy_event (event) if (! FRAME_LIVE_P (f)) return Qnil; -#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) +#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) && ! defined (HAVE_NS) /* EVENT->x and EVENT->y are frame-relative pixel coordinates at this place. Under old redisplay, COLUMN and ROW are set to frame relative glyph coordinates @@ -5714,7 +5719,7 @@ make_lispy_event (event) return Fcons (item, Fcons (position, Qnil)); } -#endif /* not USE_X_TOOLKIT && not USE_GTK */ +#endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */ position = make_lispy_position (f, &event->x, &event->y, event->timestamp); @@ -6094,7 +6099,7 @@ make_lispy_event (event) #endif /* HAVE_MOUSE */ #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined(HAVE_NS) || defined (USE_GTK) case MENU_BAR_EVENT: if (EQ (event->arg, event->frame_or_window)) /* This is the prefix key. We translate this to @@ -7988,9 +7993,18 @@ parse_menu_item (item, notreal, inmenubar) if (NILP (cachelist)) { /* We have to create a cachelist. */ - CHECK_IMPURE (start); - XSETCDR (start, Fcons (Fcons (Qnil, Qnil), XCDR (start))); - cachelist = XCAR (XCDR (start)); + /* With the introduction of where_is_cache, the computation + of equivalent key bindings is sufficiently fast that we + do not need to cache it here any more. */ +/*PENDING: under NS this effect does not hold, perhaps due to the + modifier-preference changes to where-is-internal.. */ +#ifdef HAVE_NS + CHECK_IMPURE (start); + XSETCDR (start, Fcons (Fcons (Qnil, Qnil), XCDR (start))); + cachelist = XCAR (XCDR (start)); +#else + cachelist = Fcons (Qnil, Qnil); +#endif newcache = 1; tem = AREF (item_properties, ITEM_PROPERTY_KEYEQ); if (!NILP (keyhint)) @@ -8056,7 +8070,12 @@ parse_menu_item (item, notreal, inmenubar) && SYMBOLP (XSYMBOL (def)->function) && ! NILP (Fget (def, Qmenu_alias))) def = XSYMBOL (def)->function; +#ifdef HAVE_NS + /* prefer 'super' bindings */ + tem = Fwhere_is_internal (def, Qnil, Qsuper, Qt, Qt); +#else tem = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qt); +#endif XSETCAR (cachelist, tem); if (NILP (tem)) { @@ -8089,7 +8108,7 @@ parse_menu_item (item, notreal, inmenubar) if (newcache && !NILP (tem)) { tem = concat2 (build_string (" "), tem); - // tem = concat3 (build_string (" ("), tem, build_string (")")); + /* tem = concat3 (build_string (" ("), tem, build_string (")")); */ XSETCDR (cachelist, tem); } @@ -11573,8 +11592,7 @@ static void wipe_kboard (kb) KBOARD *kb; { - if (kb->kbd_macro_buffer) - xfree (kb->kbd_macro_buffer); + xfree (kb->kbd_macro_buffer); } #ifdef MULTI_KBOARD