summaryrefslogtreecommitdiff
path: root/src/w32menu.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-02-04 18:13:51 +0200
committerEli Zaretskii <eliz@gnu.org>2014-02-04 18:13:51 +0200
commite139a33cd97a0e12405cae760ca5e436d9dcbc74 (patch)
treee744130600582bf8005e7aad818c55a662a18428 /src/w32menu.c
parent40d2f2e4bb6b4e0b373180ae12836f6b335dc0bb (diff)
downloademacs-e139a33cd97a0e12405cae760ca5e436d9dcbc74.tar.gz
Fix bug #16636 with simple dialogs on MS-Windows.
src/w32menu.c (w32_popup_dialog): Don't condition the whole function on HAVE_DIALOGS. If the dialog is "simple", pop up a message box to show it; otherwise return 'unsupported--w32-dialog' to signal to the caller that emulation with menus is necessary. This resurrects code inadvertently deleted by the 2013-10-08 commit. (syms_of_w32menu): DEFSYM Qunsupported__w32_dialog. src/w32term.h (w32_popup_dialog): Prototype is no longer conditioned by HAVE_DIALOGS. src/menu.c (Fx_popup_dialog): Don't condition the call to w32_popup_dialog on HAVE_DIALOGS. If w32_popup_dialog returns a special symbol 'unsupported--w32-dialog', emulate the dialog with a menu by calling x-popup-menu. src/menu.h (Qunsupported__w32_dialog): New extern variable.
Diffstat (limited to 'src/w32menu.c')
-rw-r--r--src/w32menu.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/w32menu.c b/src/w32menu.c
index c0983a7c2e7..a4acdfd9e91 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -98,7 +98,7 @@ AppendMenuW_Proc unicode_append_menu = NULL;
MessageBoxW_Proc unicode_message_box = NULL;
#endif /* NTGUI_UNICODE */
-Lisp_Object Qdebug_on_next_call;
+Lisp_Object Qdebug_on_next_call, Qunsupported__w32_dialog;
void set_frame_menubar (struct frame *, bool, bool);
@@ -114,34 +114,44 @@ static int fill_in_menu (HMENU, widget_value *);
void w32_free_menu_strings (HWND);
-#ifdef HAVE_DIALOGS
Lisp_Object
w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
{
- Lisp_Object title;
- char *error_name;
- Lisp_Object selection;
check_window_system (f);
- /* Decode the dialog items from what was specified. */
- title = Fcar (contents);
- CHECK_STRING (title);
+#ifndef HAVE_DIALOGS
- list_of_panes (Fcons (contents, Qnil));
+ /* Handle simple Yes/No choices as MessageBox popups. */
+ if (is_simple_dialog (contents))
+ return simple_dialog_show (f, contents, header);
+ else
+ return Qunsupported__w32_dialog;
+#else /* HAVE_DIALOGS */
+ {
+ Lisp_Object title;
+ char *error_name;
+ Lisp_Object selection;
- /* Display them in a dialog box. */
- block_input ();
- selection = w32_dialog_show (f, 0, title, header, &error_name);
- unblock_input ();
+ /* Decode the dialog items from what was specified. */
+ title = Fcar (contents);
+ CHECK_STRING (title);
- discard_menu_items ();
- FRAME_DISPLAY_INFO (f)->grabbed = 0;
+ list_of_panes (Fcons (contents, Qnil));
- if (error_name) error (error_name);
- return selection;
-}
+ /* Display them in a dialog box. */
+ block_input ();
+ selection = w32_dialog_show (f, 0, title, header, &error_name);
+ unblock_input ();
+
+ discard_menu_items ();
+ FRAME_DISPLAY_INFO (f)->grabbed = 0;
+
+ if (error_name) error (error_name);
+ return selection;
+ }
#endif /* HAVE_DIALOGS */
+}
/* Activate the menu bar of frame F.
This is called from keyboard.c when it gets the
@@ -1621,6 +1631,7 @@ syms_of_w32menu (void)
current_popup_menu = NULL;
DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
+ DEFSYM (Qunsupported__w32_dialog, "unsupported--w32-dialog");
defsubr (&Smenu_or_popup_active_p);
}