summaryrefslogtreecommitdiff
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
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.
-rw-r--r--src/ChangeLog20
-rw-r--r--src/menu.c12
-rw-r--r--src/menu.h4
-rw-r--r--src/w32menu.c47
-rw-r--r--src/w32term.h2
5 files changed, 63 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 746bdffad22..5bba143826f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
+2014-02-04 Eli Zaretskii <eliz@gnu.org>
+
+ * 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.
+ (Bug#16636)
+ (syms_of_w32menu): DEFSYM Qunsupported__w32_dialog.
+
+ * w32term.h (w32_popup_dialog): Prototype is no longer conditioned
+ by HAVE_DIALOGS.
+
+ * 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.
+
+ * menu.h (Qunsupported__w32_dialog): New extern variable.
+
2014-02-04 Michael Albinus <michael.albinus@gmx.de>
* keyboard.c (kbd_buffer_get_event): Read file notification events
diff --git a/src/menu.c b/src/menu.c
index c38152f47e8..47ebc922b84 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1566,9 +1566,15 @@ for instance using the window manager, then this produces a quit and
return xw_popup_dialog (f, header, contents);
else
#endif
-#if defined (HAVE_NTGUI) && defined (HAVE_DIALOGS)
+#if defined (HAVE_NTGUI)
if (FRAME_W32_P (f))
- return w32_popup_dialog (f, header, contents);
+ {
+ Lisp_Object selection = w32_popup_dialog (f, header, contents);
+
+ if (!EQ (selection, Qunsupported__w32_dialog))
+ return selection;
+ goto dialog_via_menu;
+ }
else
#endif
#ifdef HAVE_NS
@@ -1582,6 +1588,8 @@ for instance using the window manager, then this produces a quit and
Lisp_Object x, y, frame, newpos, prompt;
int x_coord, y_coord;
+ dialog_via_menu:
+
prompt = Fcar (contents);
if (FRAME_WINDOW_P (f))
{
diff --git a/src/menu.h b/src/menu.h
index ae97fe2e458..429dcfa6221 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -21,6 +21,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "systime.h" /* for Time */
+#ifdef HAVE_NTGUI
+extern Lisp_Object Qunsupported__w32_dialog;
+#endif
+
extern void x_set_menu_bar_lines (struct frame *f,
Lisp_Object value,
Lisp_Object oldval);
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);
}
diff --git a/src/w32term.h b/src/w32term.h
index f85e6bced8b..e3b65f0ffaf 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -781,9 +781,7 @@ typedef char guichar_t;
#define GUI_SDATA(x) ((guichar_t*) SDATA (x))
-#if defined HAVE_DIALOGS
extern Lisp_Object w32_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
-#endif
extern void syms_of_w32term (void);
extern void syms_of_w32menu (void);