/* X Communication module for terminals which understand the X protocol.
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2013 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2014 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
popup_activated_flag = 1;
-#ifdef USE_X_TOOLKIT
x_activate_timeout_atimer ();
-#endif
}
#endif
#ifdef USE_GTK
/* If we have detached menus, we must update deep so detached menus
also gets updated. */
- deep_p = deep_p || xg_have_tear_offs ();
+ deep_p = deep_p || xg_have_tear_offs (f);
#endif
if (deep_p)
/* Save the frame's previous menu bar contents data. */
if (previous_menu_items_used)
- memcpy (previous_items, XVECTOR (f->menu_bar_vector)->u.contents,
+ memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
previous_menu_items_used * word_size);
/* Fill in menu_items with the current menu bar contents.
if (x1 == 0 && y1 == 0)
XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
#endif
- x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
+ x_set_window_size (f, 0, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 1);
}
unblock_input ();
}
menu pops down.
menu_item_selection will be set to the selection. */
static void
-create_and_show_popup_menu (struct frame *f, widget_value *first_wv, int x, int y,
- bool for_click, Time timestamp)
+create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
+ int x, int y, bool for_click)
{
int i;
GtkWidget *menu;
for (i = 0; i < 5; i++)
if (FRAME_DISPLAY_INFO (f)->grabbed & (1 << i))
break;
+ // If keys aren't grabbed (i.e. a mouse up event), use 0.
+ if (i == 5) i = 0;
}
/* Display the menu. */
gtk_widget_show_all (menu);
gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
- timestamp ? timestamp : gtk_get_current_event_time ());
+ FRAME_DISPLAY_INFO (f)->last_user_time);
record_unwind_protect_ptr (pop_down_menu, menu);
menu_item_selection will be set to the selection. */
static void
create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
- int x, int y, bool for_click, Time timestamp)
+ int x, int y, bool for_click)
{
int i;
Arg av[2];
Lisp_Object
xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
- Lisp_Object title, const char **error_name, Time timestamp)
+ Lisp_Object title, const char **error_name)
{
int i;
widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
#endif
wv_title->name = SSDATA (title);
- wv_title->enabled = TRUE;
+ wv_title->enabled = true;
wv_title->button_type = BUTTON_TYPE_NONE;
wv_title->help = Qnil;
wv_title->next = wv_sep1;
record_unwind_protect_ptr (cleanup_widget_value_tree, first_wv);
/* Actually create and show the menu until popped down. */
- create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp);
+ create_and_show_popup_menu (f, first_wv, x, y, for_click);
unbind_to (specpdl_count, Qnil);
Lisp_Object pane_name;
Lisp_Object menu_object;
- first_item = XVECTOR (menu_items)->u.contents;
+ first_item = XVECTOR (menu_items)->contents;
if (EQ (first_item[0], Qt))
pane_name = first_item[MENU_ITEMS_PANE_NAME];
else if (EQ (first_item[0], Qquote))
Lisp_Object
xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
- Lisp_Object title, const char **error_name, Time timestamp)
+ Lisp_Object title, const char **error_name)
{
Window root;
XMenu *menu;
doc: /* Return t if a menu or popup dialog is active. */)
(void)
{
-#ifdef HAVE_MENUS
return (popup_activated ()) ? Qt : Qnil;
-#else
- return Qnil;
-#endif /* HAVE_MENUS */
}
\f
void