# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1163492524 0 # Node ID 531d6c96fc7000c82720b0db6f8907695fd27790 # Parent 6b0e5b6fca4fb68f012c0914bce1845a3ac3927b (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 -r 6b0e5b6fca4f -r 531d6c96fc70 src/macmenu.c --- a/src/macmenu.c Tue Nov 14 08:21:57 2006 +0000 +++ b/src/macmenu.c Tue Nov 14 08:22:04 2006 +0000 @@ -319,7 +319,7 @@ 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 @@ /* 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 @@ 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 @@ 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 @@ 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.