/* 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, 2007, 2008 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Emacs.
static int next_menubar_widget_id;
+/* For NS and NTGUI, these prototypes are defined in keyboard.h. */
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
extern widget_value *xmalloc_widget_value P_ ((void));
extern widget_value *digest_single_submenu P_ ((int, int, int));
Lisp_Object bar_window;
enum scroll_bar_part part;
unsigned long time;
+ void (*mouse_position_hook) P_ ((struct frame **, int,
+ Lisp_Object *,
+ enum scroll_bar_part *,
+ Lisp_Object *,
+ Lisp_Object *,
+ unsigned long *)) =
+ new_f->terminal->mouse_position_hook;
if (mouse_position_hook)
(*mouse_position_hook) (&new_f, 1, &bar_window,
xpos += XINT (x);
ypos += XINT (y);
- if (! FRAME_X_P (f))
- error ("Can not put X menu on non-X terminal");
+ if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
+ error ("Can not put X menu on this terminal");
XSETFRAME (Vmenu_updating_frame, f);
}
but I don't want to make one now. */
CHECK_WINDOW (window);
- if (! FRAME_X_P (f))
- error ("Can not put X dialog on non-X terminal");
+ if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
+ error ("Can not put X dialog on this terminal");
#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
/* Display a menu with these alternatives
/* Activate the first menu. */
GList *children = gtk_container_get_children (GTK_CONTAINER (menubar));
- gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar),
- GTK_WIDGET (children->data));
-
- popup_activated_flag = 1;
- g_list_free (children);
+ if (children)
+ {
+ g_signal_emit_by_name (children->data, "activate_item");
+ popup_activated_flag = 1;
+ g_list_free (children);
+ }
}
UNBLOCK_INPUT;
{
struct next_popup_x_y* data = (struct next_popup_x_y*)user_data;
GtkRequisition req;
- int disp_width = FRAME_X_DISPLAY_INFO (data->f)->width;
- int disp_height = FRAME_X_DISPLAY_INFO (data->f)->height;
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (data->f);
+ int disp_width = x_display_pixel_width (dpyinfo);
+ int disp_height = x_display_pixel_height (dpyinfo);
*x = data->x;
*y = data->y;
unsigned int dummy_uint;
int specpdl_count = SPECPDL_INDEX ();
- if (! FRAME_X_P (f))
+ if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
abort ();
*error = 0;
y -= (uly + height) - dispheight;
uly = dispheight - height;
}
+#ifndef HAVE_X_WINDOWS
+ if (FRAME_HAS_MINIBUF_P (f) && uly+height > dispheight - 1)
+ {
+ /* Move the menu away of the echo area, to avoid overwriting the
+ menu with help echo messages or vice versa. */
+ if (BUFFERP (echo_area_buffer[0]) && WINDOWP (echo_area_window))
+ {
+ y -= WINDOW_TOTAL_LINES (XWINDOW (echo_area_window));
+ uly -= WINDOW_TOTAL_LINES (XWINDOW (echo_area_window));
+ }
+ else
+ {
+ y--;
+ uly--;
+ }
+ }
+#endif
if (ulx < 0) x -= ulx;
if (uly < 0) y -= uly;