/* X Communication module for terminals which understand the X protocol.
Copyright (C) 1986, 1988, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
int xpos = 0, ypos = 0;
Lisp_Object title;
char *error_name = NULL;
- Lisp_Object selection;
+ Lisp_Object selection = Qnil;
FRAME_PTR f = NULL;
Lisp_Object x, y, window;
int keymaps = 0;
GtkWidget *menubar;
FRAME_PTR f;
+ /* gcc 2.95 doesn't accept the FRAME_PTR declaration after
+ BLOCK_INPUT. */
+
BLOCK_INPUT;
f = check_x_frame (frame);
gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar),
GTK_WIDGET (children->data));
-
+
popup_activated_flag = 1;
g_list_free (children);
}
f->output_data.x->saved_menu_event->type = 0;
}
-/* Detect if a dialog or menu has been posted. */
-
-int
-popup_activated ()
-{
- return popup_activated_flag;
-}
-
-/* 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. */)
- ()
-{
- return (popup_activated ()) ? Qt : Qnil;
-}
-
/* This callback is invoked when the user selects a menubar cascade
pushbutton, but before the pulldown menu is posted. */
/* No selection has been chosen yet. */
menu_item_selection = 0;
+ /* Force a redisplay before showing the dialog. If a frame is created
+ just before showing the dialog, its contents may not have been fully
+ drawn, as this depends on timing of events from the X server. Redisplay
+ is not done when a dialog is shown. If redisplay could be done in the
+ X event loop (i.e. the X event loop does not run in a signal handler)
+ this would not be needed. */
+ Fredisplay (Qt);
+
/* Actually create and show the dialog. */
create_and_show_dialog (f, first_wv);
#endif /* not USE_X_TOOLKIT */
#endif /* HAVE_MENUS */
+
+/* Detect if a dialog or menu has been posted. */
+
+int
+popup_activated ()
+{
+ return popup_activated_flag;
+}
+
+/* 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. */)
+ ()
+{
+#ifdef HAVE_MENUS
+ return (popup_activated ()) ? Qt : Qnil;
+#else
+ return Qnil;
+#endif /* HAVE_MENUS */
+}
\f
void
syms_of_xmenu ()