changeset 73992:531d6c96fc70

(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.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Tue, 14 Nov 2006 08:22:04 +0000
parents 6b0e5b6fca4f
children a019988291b9
files src/macmenu.c
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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.