-/* X Communication module for terminals which understand the X protocol.
+/* Menu support for GNU Emacs on the Microsoft W32 API.
Copyright (C) 1986, 1988, 1993, 1994 Free Software Foundation, Inc.
This file is part of GNU Emacs.
extern Lisp_Object Qmenu_bar_update_hook;
-static Lisp_Object win32_dialog_show ();
-static Lisp_Object win32menu_show ();
+static Lisp_Object w32_dialog_show ();
+static Lisp_Object w32menu_show ();
static HMENU keymap_panes ();
static HMENU single_keymap_panes ();
eltcdr = XCONS (elt)->cdr;
string = XCONS (eltcdr)->car;
/* We no longer discard the @ from the beginning of the string here.
- Instead, we do this in win32menu_show. */
+ Instead, we do this in w32menu_show. */
{
HMENU new_hmenu = single_keymap_panes (lpmm,
Fcar (elt),
eltcdr = XCONS (elt)->cdr;
string = XCONS (eltcdr)->car;
/* We no longer discard the @ from the beginning of the string here.
- Instead, we do this in win32menu_show. */
+ Instead, we do this in w32menu_show. */
{
Lisp_Object event = get_single_keymap_event (Fcar (elt), lpnum);
if (! NILP (position))
{
/* Decode the first argument: find the window and the coordinates. */
- if (EQ (position, Qt))
+ if (EQ (position, Qt)
+ || (CONSP (position) && EQ (XCONS (position)->car, Qmenu_bar)))
{
/* Use the mouse's current position. */
- FRAME_PTR new_f = 0;
+ FRAME_PTR new_f = selected_frame;
Lisp_Object bar_window;
int part;
unsigned long time;
if (mouse_position_hook)
- (*mouse_position_hook) (&new_f, &bar_window, &part, &x, &y, &time);
+ (*mouse_position_hook) (&new_f, 1, &bar_window,
+ &part, &x, &y, &time);
if (new_f != 0)
XSETFRAME (window, new_f);
else
CHECK_LIVE_WINDOW (window, 0);
f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
- xpos = (FONT_WIDTH (f->output_data.win32->font) * XWINDOW (window)->left);
- ypos = (f->output_data.win32->line_height * XWINDOW (window)->top);
+ xpos = (FONT_WIDTH (f->output_data.w32->font) * XWINDOW (window)->left);
+ ypos = (f->output_data.w32->line_height * XWINDOW (window)->top);
}
else
/* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME,
/* Display them in a menu. */
BLOCK_INPUT;
- selection = win32menu_show (f, xpos, ypos, menu, &hmenu, &error_name);
+ selection = w32menu_show (f, xpos, ypos, menu, &hmenu, &error_name);
UNBLOCK_INPUT;
/* Display them in a dialog box. */
BLOCK_INPUT;
- selection = win32_dialog_show (f, 0, 0, title, &error_name);
+ selection = w32_dialog_show (f, 0, 0, title, &error_name);
UNBLOCK_INPUT;
discard_menu_items ();
because it is not reentrant. */
specbind (Qdebug_on_next_call, Qnil);
- record_unwind_protect (Fstore_match_data, Fmatch_data ());
+ record_unwind_protect (Fstore_match_data, Fmatch_data (Qnil, Qnil));
if (NILP (Voverriding_local_map_menu_flag))
{
specbind (Qoverriding_terminal_local_map, Qnil);
BLOCK_INPUT;
{
- HMENU old = GetMenu (FRAME_WIN32_WINDOW (f));
- SetMenu (FRAME_WIN32_WINDOW (f), hmenu);
+ HMENU old = GetMenu (FRAME_W32_WINDOW (f));
+ SetMenu (FRAME_W32_WINDOW (f), hmenu);
DestroyMenu (old);
}
BLOCK_INPUT;
{
- HMENU old = GetMenu (FRAME_WIN32_WINDOW (f));
- SetMenu (FRAME_WIN32_WINDOW (f), NULL);
+ HMENU old = GetMenu (FRAME_W32_WINDOW (f));
+ SetMenu (FRAME_W32_WINDOW (f), NULL);
DestroyMenu (old);
}
UNBLOCK_INPUT;
}
-/* Called from Fwin32_create_frame to create the initial menubar of a frame
+/* Called from Fw32_create_frame to create the initial menubar of a frame
before it is mapped, so that the window is mapped with the menubar already
there instead of us tacking it on later and thrashing the window after it
is visible. */
Lisp_Object x, y;
unsigned long time;
- (*mouse_position_hook) (&new_f, &bar_window, &part, &x, &y, &time);
+ (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time);
if (f == new_f && other_menu_bar_item_p (f, x, y))
{
#endif
-/* win32menu_show actually displays a menu using the panes and items in
+/* w32menu_show actually displays a menu using the panes and items in
menu_items and returns the value selected from it.
- There are two versions of win32menu_show, one for Xt and one for Xlib.
+ There are two versions of w32menu_show, one for Xt and one for Xlib.
Both assume input is blocked by the caller. */
/* F is the frame the menu is for.
static Lisp_Object
-win32menu_show (f, x, y, menu, hmenu, error)
+w32menu_show (f, x, y, menu, hmenu, error)
FRAME_PTR f;
int x;
int y;
pos.y = y;
/* Offset the coordinates to root-relative. */
- ClientToScreen (FRAME_WIN32_WINDOW (f), &pos);
+ ClientToScreen (FRAME_W32_WINDOW (f), &pos);
#if 0
/* If the mouse moves out of the menu before we show the menu,
0x10,
pos.x, pos.y,
0,
- FRAME_WIN32_WINDOW (f),
+ FRAME_W32_WINDOW (f),
NULL);
if (menu_selection == -1)
{
};
static Lisp_Object
-win32_dialog_show (f, menubarp, keymaps, title, error)
+w32_dialog_show (f, menubarp, keymaps, title, error)
FRAME_PTR f;
int menubarp;
int keymaps;
/* Actually create the dialog. */
dialog_id = ++popup_id_tick;
menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
- f->output_data.win32->widget, 1, 0,
+ f->output_data.w32->widget, 1, 0,
dialog_selection_callback, 0);
#if 0 /* This causes crashes, and seems to be redundant -- rms. */
lw_modify_all_widgets (dialog_id, first_wv, True);
That is not necessarily true, but the fiction leads to reasonable
results, and it is a pain to ask which are actually held now
or track this in the loop above. */
- win32_mouse_grabbed = 0;
+ w32_mouse_grabbed = 0;
/* Unread any events that we got but did not handle. */
while (queue != NULL)
}
#endif
-syms_of_win32menu ()
+syms_of_w32menu ()
{
Qdebug_on_next_call = intern ("debug-on-next-call");
staticpro (&Qdebug_on_next_call);