From: YAMAMOTO Mitsuharu Date: Tue, 14 Nov 2006 08:22:04 +0000 (+0000) Subject: (menu_quit_handler, install_menu_quit_handler): X-Git-Tag: emacs-pretest-22.0.91~68 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=74e537fb6901a1514514bcdc20582ad0ffb538a2;p=emacs.git (menu_quit_handler, install_menu_quit_handler): Replace `#ifdef HAVE_CANCELMENUTRACKING' with `#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030'. (install_menu_quit_handler) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 && MAC_OS_X_VERSION_MIN_REQUIRED == 1020]: Check if CancelMenuTracking is available. --- diff --git a/src/macmenu.c b/src/macmenu.c index d8303dbdc25..14bfe92cb25 100644 --- a/src/macmenu.c +++ b/src/macmenu.c @@ -319,7 +319,7 @@ restore_menu_items (saved) menu_items_used = XINT (XCAR (saved)); saved = XCDR (saved); menu_items_n_panes = XINT (XCAR (saved)); - saved = XCDR (saved); + saved = XCDR (saved); menu_items_submenu_depth = XINT (XCAR (saved)); return Qnil; } @@ -1453,7 +1453,7 @@ update_submenu_strings (first_wv) /* Event handler function that pops down a menu on C-g. We can only pop down menus if CancelMenuTracking is present (OSX 10.3 or later). */ -#ifdef HAVE_CANCELMENUTRACKING +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 static pascal OSStatus menu_quit_handler (nextHandler, theEvent, userData) EventHandlerCallRef nextHandler; @@ -1487,7 +1487,7 @@ menu_quit_handler (nextHandler, theEvent, userData) return CallNextEventHandler (nextHandler, theEvent); } -#endif /* HAVE_CANCELMENUTRACKING */ +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ /* Add event handler to all menus that belong to KIND so we can detect C-g. MENU_HANDLE is the root menu of the tracking session to dismiss @@ -1499,11 +1499,15 @@ install_menu_quit_handler (kind, menu_handle) enum mac_menu_kind kind; MenuHandle menu_handle; { -#ifdef HAVE_CANCELMENUTRACKING +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 static const EventTypeSpec typesList[] = {{kEventClassKeyboard, kEventRawKeyDown}}; int id; +#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 + if (CancelMenuTracking == NULL) + return; +#endif for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++) { MenuHandle menu = GetMenuHandle (id); @@ -1512,9 +1516,9 @@ install_menu_quit_handler (kind, menu_handle) break; InstallMenuEventHandler (menu, menu_quit_handler, GetEventTypeCount (typesList), - typesList, menu_handle, NULL); + typesList, menu_handle, NULL); } -#endif /* HAVE_CANCELMENUTRACKING */ +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ } /* Set the contents of the menubar widgets of frame F.