diff options
Diffstat (limited to 'src/xmenu.c')
-rw-r--r-- | src/xmenu.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 49cd5940eae..96c278d42d0 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -3,6 +3,10 @@ Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2019 Free Software Foundation, Inc. +Author: Jon Arnold + Roman Budzianowski + Robert Krawitz + This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify @@ -20,9 +24,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ /* X pop-up deck-of-cards menu facility for GNU Emacs. * - * Written by Jon Arnold and Roman Budzianowski - * Mods and rewrite by Robert Krawitz - * */ /* Modified by Fred Pierresteguy on December 93 @@ -278,12 +279,7 @@ popup_get_selection (XEvent *initial_event, struct x_display_info *dpyinfo, } DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, Sx_menu_bar_open_internal, 0, 1, "i", - doc: /* Start key navigation of the menu bar in FRAME. -This initially opens the first menu bar item and you can then navigate with the -arrow keys, select a menu entry with the return key or cancel with the -escape key. If FRAME has no menu bar this function does nothing. - -If FRAME is nil or not given, use the selected frame. */) + doc: /* SKIP: real doc in USE_GTK definition in xmenu.c. */) (Lisp_Object frame) { XEvent ev; @@ -1177,17 +1173,17 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer items in x-display-monitor-attributes-list. */ workarea = call3 (Qframe_monitor_workarea, Qnil, - make_number (data->x), - make_number (data->y)); + make_fixnum (data->x), + make_fixnum (data->y)); if (CONSP (workarea)) { int min_x, min_y; - min_x = XINT (XCAR (workarea)); - min_y = XINT (Fnth (make_number (1), workarea)); - max_x = min_x + XINT (Fnth (make_number (2), workarea)); - max_y = min_y + XINT (Fnth (make_number (3), workarea)); + min_x = XFIXNUM (XCAR (workarea)); + min_y = XFIXNUM (Fnth (make_fixnum (1), workarea)); + max_x = min_x + XFIXNUM (Fnth (make_fixnum (2), workarea)); + max_y = min_y + XFIXNUM (Fnth (make_fixnum (3), workarea)); } if (max_x < 0 || max_y < 0) @@ -1491,7 +1487,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, i = 0; while (i < menu_items_used) { - if (EQ (AREF (menu_items, i), Qnil)) + if (NILP (AREF (menu_items, i))) { submenu_stack[submenu_depth++] = save_wv; save_wv = prev_wv; @@ -1660,7 +1656,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, i = 0; while (i < menu_items_used) { - if (EQ (AREF (menu_items, i), Qnil)) + if (NILP (AREF (menu_items, i))) { subprefix_stack[submenu_depth++] = prefix; prefix = entry; @@ -2047,16 +2043,23 @@ menu_help_callback (char const *help_string, int pane, int item) pane_name = first_item[MENU_ITEMS_ITEM_NAME]; /* (menu-item MENU-NAME PANE-NUMBER) */ - menu_object = list3 (Qmenu_item, pane_name, make_number (pane)); + menu_object = list3 (Qmenu_item, pane_name, make_fixnum (pane)); show_help_echo (help_string ? build_string (help_string) : Qnil, - Qnil, menu_object, make_number (item)); + Qnil, menu_object, make_fixnum (item)); } +struct pop_down_menu +{ + struct frame *frame; + XMenu *menu; +}; + static void -pop_down_menu (Lisp_Object arg) +pop_down_menu (void *arg) { - struct frame *f = XSAVE_POINTER (arg, 0); - XMenu *menu = XSAVE_POINTER (arg, 1); + struct pop_down_menu *data = arg; + struct frame *f = data->frame; + XMenu *menu = data->menu; block_input (); #ifndef MSDOS @@ -2302,7 +2305,8 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, XMenuActivateSetWaitFunction (x_menu_wait_for_event, FRAME_X_DISPLAY (f)); #endif - record_unwind_protect (pop_down_menu, make_save_ptr_ptr (f, menu)); + record_unwind_protect_ptr (pop_down_menu, + &(struct pop_down_menu) {f, menu}); /* Help display under X won't work because XMenuActivate contains a loop that doesn't give Emacs a chance to process it. */ @@ -2371,8 +2375,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, return_entry: unblock_input (); - SAFE_FREE (); - return unbind_to (specpdl_count, entry); + return SAFE_FREE_UNBIND_TO (specpdl_count, entry); } #endif /* not USE_X_TOOLKIT */ @@ -2391,7 +2394,8 @@ popup_activated (void) /* The following is used by delayed window autoselection. */ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0, - doc: /* Return t if a menu or popup dialog is active. */) + doc: /* Return t if a menu or popup dialog is active. +\(On MS Windows, this refers to the selected frame.) */) (void) { return (popup_activated ()) ? Qt : Qnil; @@ -2416,6 +2420,6 @@ syms_of_xmenu (void) #if defined (USE_GTK) || defined (USE_X_TOOLKIT) defsubr (&Sx_menu_bar_open_internal); Ffset (intern_c_string ("accelerate-menu"), - intern_c_string (Sx_menu_bar_open_internal.symbol_name)); + intern_c_string (Sx_menu_bar_open_internal.s.symbol_name)); #endif } |