X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/852a74a59b12d505eba86a0aed46bfe8af7b9acf..542f2c78acd26112754474223c85311d6c9cc2eb:/src/xmenu.c diff --git a/src/xmenu.c b/src/xmenu.c index 2a4359fa84..b4338c1d65 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -240,7 +240,7 @@ for instance using the window manager, then this produces a quit and FRAME_PTR new_f = SELECTED_FRAME (); Lisp_Object bar_window; enum scroll_bar_part part; - unsigned long time; + Time time; Lisp_Object x, y; (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); @@ -347,6 +347,8 @@ for instance using the window manager, then this produces a quit and #ifndef MSDOS +#if defined USE_GTK || defined USE_MOTIF + /* Set menu_items_inuse so no other popup menu or dialog is created. */ void @@ -360,6 +362,8 @@ x_menu_set_in_use (int in_use) #endif } +#endif + /* Wait for an X event to arrive or for a timer to expire. */ #ifndef USE_MOTIF @@ -736,10 +740,13 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data) help = call_data ? cb_data->help : Qnil; /* If popup_activated_flag is greater than 1 we are in a popup menu. - Don't show help for them, they won't appear before the - popup is popped down. */ - if (popup_activated_flag <= 1) - show_help_event (cb_data->cl_data->f, widget, help); + Don't pass the frame to show_help_event for those. + Passing frame creates an Emacs event. As we are looping in + popup_widget_loop, it won't be handeled. Passing NULL shows the tip + directly without using an Emacs event. This is what the Lucid code + does below. */ + show_help_event (popup_activated_flag <= 1 ? cb_data->cl_data->f : NULL, + widget, help); } #else static void @@ -922,7 +929,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) #endif Lisp_Object items; widget_value *wv, *first_wv, *prev_wv = 0; - EMACS_UINT i, last_i = 0; + int i; int *submenu_start, *submenu_end; int *submenu_top_level_items, *submenu_n_panes; @@ -966,7 +973,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) Lisp_Object *previous_items = (Lisp_Object *) alloca (previous_menu_items_used * sizeof (Lisp_Object)); - EMACS_UINT subitems; + int subitems; /* If we are making a new widget, its contents are empty, do always reinitialize them. */ @@ -1012,7 +1019,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) menu_items = f->menu_bar_vector; menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; subitems = ASIZE (items) / 4; - submenu_start = (int *) alloca (subitems * sizeof (int)); + submenu_start = (int *) alloca ((subitems + 1) * sizeof (int)); submenu_end = (int *) alloca (subitems * sizeof (int)); submenu_n_panes = (int *) alloca (subitems * sizeof (int)); submenu_top_level_items = (int *) alloca (subitems * sizeof (int)); @@ -1021,8 +1028,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) { Lisp_Object key, string, maps; - last_i = i; - key = XVECTOR (items)->contents[4 * i]; string = XVECTOR (items)->contents[4 * i + 1]; maps = XVECTOR (items)->contents[4 * i + 2]; @@ -1039,6 +1044,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) submenu_end[i] = menu_items_used; } + submenu_start[i] = -1; finish_menu_items (); /* Convert menu_items into widget_value trees @@ -1052,7 +1058,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) wv->help = Qnil; first_wv = wv; - for (i = 0; i < last_i; i++) + for (i = 0; 0 <= submenu_start[i]; i++) { menu_items_n_panes = submenu_n_panes[i]; wv = digest_single_submenu (submenu_start[i], submenu_end[i], @@ -1421,7 +1427,8 @@ pop_down_menu (Lisp_Object arg) menu pops down. menu_item_selection will be set to the selection. */ static void -create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp) +create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, + int for_click, Time timestamp) { int i; GtkWidget *menu; @@ -1465,7 +1472,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, i gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, - timestamp > 0 ? timestamp : gtk_get_current_event_time()); + timestamp ? timestamp : gtk_get_current_event_time ()); record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); @@ -1525,7 +1532,7 @@ pop_down_menu (Lisp_Object arg) menu_item_selection will be set to the selection. */ static void create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, - int x, int y, int for_click, EMACS_UINT timestamp) + int x, int y, int for_click, Time timestamp) { int i; Arg av[2]; @@ -1599,7 +1606,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error_name, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, Time timestamp) { int i; widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; @@ -1919,9 +1926,9 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) static void dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) { - /* The EMACS_INT cast avoids a warning. There's no problem + /* Treat the pointer as an integer. There's no problem as long as pointers have enough bits to hold small integers. */ - if ((int) (EMACS_INT) client_data != -1) + if ((intptr_t) client_data != -1) menu_item_selection = (Lisp_Object *) client_data; BLOCK_INPUT; @@ -2242,7 +2249,7 @@ pop_down_menu (Lisp_Object arg) Lisp_Object xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, - Lisp_Object title, const char **error_name, EMACS_UINT timestamp) + Lisp_Object title, const char **error_name, Time timestamp) { Window root; XMenu *menu; @@ -2555,8 +2562,7 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_ void syms_of_xmenu (void) { - Qdebug_on_next_call = intern_c_string ("debug-on-next-call"); - staticpro (&Qdebug_on_next_call); + DEFSYM (Qdebug_on_next_call, "debug-on-next-call"); #ifdef USE_X_TOOLKIT widget_id_tick = (1<<16);