diff options
| author | Po Lu | 2021-11-10 14:04:05 +0800 |
|---|---|---|
| committer | Po Lu | 2021-11-10 14:04:05 +0800 |
| commit | e9b954f0fdc91eaad32d853e82ad8cb4c53c69d2 (patch) | |
| tree | 424eb046da6c0b2e2e75651226d2c613f6da640e | |
| parent | ff9cf991c1608cd2578a66cba41e654a2b5d9144 (diff) | |
| download | emacs-e9b954f0fdc91eaad32d853e82ad8cb4c53c69d2.tar.gz emacs-e9b954f0fdc91eaad32d853e82ad8cb4c53c69d2.zip | |
Revert "Support opening the toolkit menu bar on NS"
This reverts commit ff9cf991c1608cd2578a66cba41e654a2b5d9144.
| -rw-r--r-- | lisp/menu-bar.el | 8 | ||||
| -rw-r--r-- | src/nsmenu.m | 55 | ||||
| -rw-r--r-- | src/nsterm.m | 1 |
3 files changed, 3 insertions, 61 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index e50d4fee487..1a81f1a3d06 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -2665,10 +2665,9 @@ first TTY menu-bar menu to be dropped down. Interactively, | |||
| 2665 | this is the numeric argument to the command. | 2665 | this is the numeric argument to the command. |
| 2666 | This function decides which method to use to access the menu | 2666 | This function decides which method to use to access the menu |
| 2667 | depending on FRAME's terminal device. On X displays, it calls | 2667 | depending on FRAME's terminal device. On X displays, it calls |
| 2668 | `x-menu-bar-open'; on Windows, `w32-menu-bar-open'; | 2668 | `x-menu-bar-open'; on Windows, `w32-menu-bar-open'; otherwise it |
| 2669 | on NS, `ns-menu-bar-open'; otherwise it calls either `popup-menu' | 2669 | calls either `popup-menu' or `tmm-menubar' depending on whether |
| 2670 | or `tmm-menubar' depending on whether `tty-menu-open-use-tmm' | 2670 | `tty-menu-open-use-tmm' is nil or not. |
| 2671 | is nil or not. | ||
| 2672 | 2671 | ||
| 2673 | If FRAME is nil or not given, use the selected frame." | 2672 | If FRAME is nil or not given, use the selected frame." |
| 2674 | (interactive | 2673 | (interactive |
| @@ -2677,7 +2676,6 @@ If FRAME is nil or not given, use the selected frame." | |||
| 2677 | (cond | 2676 | (cond |
| 2678 | ((eq type 'x) (x-menu-bar-open frame)) | 2677 | ((eq type 'x) (x-menu-bar-open frame)) |
| 2679 | ((eq type 'w32) (w32-menu-bar-open frame)) | 2678 | ((eq type 'w32) (w32-menu-bar-open frame)) |
| 2680 | ((eq type 'ns) (ns-menu-bar-open frame)) | ||
| 2681 | ((and (null tty-menu-open-use-tmm) | 2679 | ((and (null tty-menu-open-use-tmm) |
| 2682 | (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))) | 2680 | (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))) |
| 2683 | ;; Make sure the menu bar is up to date. One situation where | 2681 | ;; Make sure the menu bar is up to date. One situation where |
diff --git a/src/nsmenu.m b/src/nsmenu.m index b93d3a79bdc..29201e69079 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -439,44 +439,6 @@ set_frame_menubar (struct frame *f, bool deep_p) | |||
| 439 | ns_update_menubar (f, deep_p); | 439 | ns_update_menubar (f, deep_p); |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | void | ||
| 443 | ns_activate_menubar (struct frame *frame) | ||
| 444 | { | ||
| 445 | if (frame != SELECTED_FRAME () | ||
| 446 | || !FRAME_EXTERNAL_MENU_BAR (frame)) | ||
| 447 | return; | ||
| 448 | |||
| 449 | block_input (); | ||
| 450 | NSApplication *app = [NSApplication sharedApplication]; | ||
| 451 | NSMenu *menu = [app mainMenu]; | ||
| 452 | for (NSMenuItem *item in [menu itemArray]) | ||
| 453 | { | ||
| 454 | if ([item hasSubmenu]) | ||
| 455 | { | ||
| 456 | #ifdef NS_IMPL_GNUSTEP | ||
| 457 | [[item submenu] display]; | ||
| 458 | #else | ||
| 459 | NSWindow *window = [FRAME_NS_VIEW (frame) window]; | ||
| 460 | NSScreen *screen = [window screen]; | ||
| 461 | |||
| 462 | NSRect screen_frame = [screen frame]; | ||
| 463 | [app postEvent: [NSEvent mouseEventWithType: NSLeftMouseDown | ||
| 464 | location: NSMakePoint (NSMinX (screen_frame), | ||
| 465 | NSMinY (screen_frame) + 10) | ||
| 466 | modifierFlags: 0 | ||
| 467 | timestamp: 0 | ||
| 468 | windowNumber: [window windowNumber] | ||
| 469 | context: [NSGraphicsContext currentContext] | ||
| 470 | eventNumber: 0 | ||
| 471 | clickCount: 1 | ||
| 472 | pressure: 1.0f] | ||
| 473 | atStart: YES]; | ||
| 474 | #endif | ||
| 475 | break; | ||
| 476 | } | ||
| 477 | } | ||
| 478 | unblock_input (); | ||
| 479 | } | ||
| 480 | 442 | ||
| 481 | /* ========================================================================== | 443 | /* ========================================================================== |
| 482 | 444 | ||
| @@ -1954,22 +1916,6 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_ | |||
| 1954 | return popup_activated () ? Qt : Qnil; | 1916 | return popup_activated () ? Qt : Qnil; |
| 1955 | } | 1917 | } |
| 1956 | 1918 | ||
| 1957 | DEFUN ("ns-menu-bar-open", Fns_menu_bar_open, Sns_menu_bar_open, 0, 1, "i", | ||
| 1958 | doc: /* Start key navigation of the menu bar in FRAME. | ||
| 1959 | This initially opens the first menu bar item and you can then navigate with the | ||
| 1960 | arrow keys, select a menu entry with the return key or cancel with the | ||
| 1961 | escape key. If FRAME has no menu bar this function does nothing. | ||
| 1962 | |||
| 1963 | If FRAME is nil or not given, use the selected frame. */) | ||
| 1964 | (Lisp_Object frame) | ||
| 1965 | { | ||
| 1966 | struct frame *f = decode_window_system_frame (frame); | ||
| 1967 | |||
| 1968 | ns_activate_menubar (f); | ||
| 1969 | |||
| 1970 | return Qnil; | ||
| 1971 | } | ||
| 1972 | |||
| 1973 | /* ========================================================================== | 1919 | /* ========================================================================== |
| 1974 | 1920 | ||
| 1975 | Lisp interface declaration | 1921 | Lisp interface declaration |
| @@ -1981,7 +1927,6 @@ syms_of_nsmenu (void) | |||
| 1981 | { | 1927 | { |
| 1982 | defsubr (&Sns_reset_menu); | 1928 | defsubr (&Sns_reset_menu); |
| 1983 | defsubr (&Smenu_or_popup_active_p); | 1929 | defsubr (&Smenu_or_popup_active_p); |
| 1984 | defsubr (&Sns_menu_bar_open); | ||
| 1985 | 1930 | ||
| 1986 | DEFSYM (Qdebug_on_next_call, "debug-on-next-call"); | 1931 | DEFSYM (Qdebug_on_next_call, "debug-on-next-call"); |
| 1987 | } | 1932 | } |
diff --git a/src/nsterm.m b/src/nsterm.m index 4e84e130b89..ed0e7a2aae8 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -5067,7 +5067,6 @@ ns_create_terminal (struct ns_display_info *dpyinfo) | |||
| 5067 | terminal->delete_frame_hook = ns_destroy_window; | 5067 | terminal->delete_frame_hook = ns_destroy_window; |
| 5068 | terminal->delete_terminal_hook = ns_delete_terminal; | 5068 | terminal->delete_terminal_hook = ns_delete_terminal; |
| 5069 | terminal->change_tab_bar_height_hook = ns_change_tab_bar_height; | 5069 | terminal->change_tab_bar_height_hook = ns_change_tab_bar_height; |
| 5070 | terminal->activate_menubar_hook = ns_activate_menubar; | ||
| 5071 | /* Other hooks are NULL by default. */ | 5070 | /* Other hooks are NULL by default. */ |
| 5072 | 5071 | ||
| 5073 | return terminal; | 5072 | return terminal; |