Mercurial > emacs
comparison src/macmenu.c @ 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 | 497b9d9c1774 |
children | 75f560bd7282 dbe3f29e61d6 |
comparison
equal
deleted
inserted
replaced
73991:6b0e5b6fca4f | 73992:531d6c96fc70 |
---|---|
317 menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0); | 317 menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0); |
318 saved = XCDR (saved); | 318 saved = XCDR (saved); |
319 menu_items_used = XINT (XCAR (saved)); | 319 menu_items_used = XINT (XCAR (saved)); |
320 saved = XCDR (saved); | 320 saved = XCDR (saved); |
321 menu_items_n_panes = XINT (XCAR (saved)); | 321 menu_items_n_panes = XINT (XCAR (saved)); |
322 saved = XCDR (saved); | 322 saved = XCDR (saved); |
323 menu_items_submenu_depth = XINT (XCAR (saved)); | 323 menu_items_submenu_depth = XINT (XCAR (saved)); |
324 return Qnil; | 324 return Qnil; |
325 } | 325 } |
326 | 326 |
327 /* Push the whole state of menu_items processing onto the specpdl. | 327 /* Push the whole state of menu_items processing onto the specpdl. |
1451 | 1451 |
1452 | 1452 |
1453 /* Event handler function that pops down a menu on C-g. We can only pop | 1453 /* Event handler function that pops down a menu on C-g. We can only pop |
1454 down menus if CancelMenuTracking is present (OSX 10.3 or later). */ | 1454 down menus if CancelMenuTracking is present (OSX 10.3 or later). */ |
1455 | 1455 |
1456 #ifdef HAVE_CANCELMENUTRACKING | 1456 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 |
1457 static pascal OSStatus | 1457 static pascal OSStatus |
1458 menu_quit_handler (nextHandler, theEvent, userData) | 1458 menu_quit_handler (nextHandler, theEvent, userData) |
1459 EventHandlerCallRef nextHandler; | 1459 EventHandlerCallRef nextHandler; |
1460 EventRef theEvent; | 1460 EventRef theEvent; |
1461 void* userData; | 1461 void* userData; |
1485 return noErr; | 1485 return noErr; |
1486 } | 1486 } |
1487 | 1487 |
1488 return CallNextEventHandler (nextHandler, theEvent); | 1488 return CallNextEventHandler (nextHandler, theEvent); |
1489 } | 1489 } |
1490 #endif /* HAVE_CANCELMENUTRACKING */ | 1490 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ |
1491 | 1491 |
1492 /* Add event handler to all menus that belong to KIND so we can detect C-g. | 1492 /* Add event handler to all menus that belong to KIND so we can detect C-g. |
1493 MENU_HANDLE is the root menu of the tracking session to dismiss | 1493 MENU_HANDLE is the root menu of the tracking session to dismiss |
1494 when C-g is detected. NULL means the menu bar. | 1494 when C-g is detected. NULL means the menu bar. |
1495 If CancelMenuTracking isn't available, do nothing. */ | 1495 If CancelMenuTracking isn't available, do nothing. */ |
1497 static void | 1497 static void |
1498 install_menu_quit_handler (kind, menu_handle) | 1498 install_menu_quit_handler (kind, menu_handle) |
1499 enum mac_menu_kind kind; | 1499 enum mac_menu_kind kind; |
1500 MenuHandle menu_handle; | 1500 MenuHandle menu_handle; |
1501 { | 1501 { |
1502 #ifdef HAVE_CANCELMENUTRACKING | 1502 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 |
1503 static const EventTypeSpec typesList[] = | 1503 static const EventTypeSpec typesList[] = |
1504 {{kEventClassKeyboard, kEventRawKeyDown}}; | 1504 {{kEventClassKeyboard, kEventRawKeyDown}}; |
1505 int id; | 1505 int id; |
1506 | 1506 |
1507 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 | |
1508 if (CancelMenuTracking == NULL) | |
1509 return; | |
1510 #endif | |
1507 for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++) | 1511 for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++) |
1508 { | 1512 { |
1509 MenuHandle menu = GetMenuHandle (id); | 1513 MenuHandle menu = GetMenuHandle (id); |
1510 | 1514 |
1511 if (menu == NULL) | 1515 if (menu == NULL) |
1512 break; | 1516 break; |
1513 InstallMenuEventHandler (menu, menu_quit_handler, | 1517 InstallMenuEventHandler (menu, menu_quit_handler, |
1514 GetEventTypeCount (typesList), | 1518 GetEventTypeCount (typesList), |
1515 typesList, menu_handle, NULL); | 1519 typesList, menu_handle, NULL); |
1516 } | 1520 } |
1517 #endif /* HAVE_CANCELMENUTRACKING */ | 1521 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */ |
1518 } | 1522 } |
1519 | 1523 |
1520 /* Set the contents of the menubar widgets of frame F. | 1524 /* Set the contents of the menubar widgets of frame F. |
1521 The argument FIRST_TIME is currently ignored; | 1525 The argument FIRST_TIME is currently ignored; |
1522 it is set the first time this is called, from initialize_frame_menubar. */ | 1526 it is set the first time this is called, from initialize_frame_menubar. */ |