aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-02-04 18:13:51 +0200
committerEli Zaretskii2014-02-04 18:13:51 +0200
commite139a33cd97a0e12405cae760ca5e436d9dcbc74 (patch)
treee744130600582bf8005e7aad818c55a662a18428 /src
parent40d2f2e4bb6b4e0b373180ae12836f6b335dc0bb (diff)
downloademacs-e139a33cd97a0e12405cae760ca5e436d9dcbc74.tar.gz
emacs-e139a33cd97a0e12405cae760ca5e436d9dcbc74.zip
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')
-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 @@
12014-02-04 Eli Zaretskii <eliz@gnu.org>
2
3 * w32menu.c (w32_popup_dialog): Don't condition the whole function
4 on HAVE_DIALOGS. If the dialog is "simple", pop up a message box
5 to show it; otherwise return 'unsupported--w32-dialog' to signal
6 to the caller that emulation with menus is necessary. This
7 resurrects code inadvertently deleted by the 2013-10-08 commit.
8 (Bug#16636)
9 (syms_of_w32menu): DEFSYM Qunsupported__w32_dialog.
10
11 * w32term.h (w32_popup_dialog): Prototype is no longer conditioned
12 by HAVE_DIALOGS.
13
14 * menu.c (Fx_popup_dialog): Don't condition the call to
15 w32_popup_dialog on HAVE_DIALOGS. If w32_popup_dialog returns a
16 special symbol 'unsupported--w32-dialog', emulate the dialog with
17 a menu by calling x-popup-menu.
18
19 * menu.h (Qunsupported__w32_dialog): New extern variable.
20
12014-02-04 Michael Albinus <michael.albinus@gmx.de> 212014-02-04 Michael Albinus <michael.albinus@gmx.de>
2 22
3 * keyboard.c (kbd_buffer_get_event): Read file notification events 23 * 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
1566 return xw_popup_dialog (f, header, contents); 1566 return xw_popup_dialog (f, header, contents);
1567 else 1567 else
1568#endif 1568#endif
1569#if defined (HAVE_NTGUI) && defined (HAVE_DIALOGS) 1569#if defined (HAVE_NTGUI)
1570 if (FRAME_W32_P (f)) 1570 if (FRAME_W32_P (f))
1571 return w32_popup_dialog (f, header, contents); 1571 {
1572 Lisp_Object selection = w32_popup_dialog (f, header, contents);
1573
1574 if (!EQ (selection, Qunsupported__w32_dialog))
1575 return selection;
1576 goto dialog_via_menu;
1577 }
1572 else 1578 else
1573#endif 1579#endif
1574#ifdef HAVE_NS 1580#ifdef HAVE_NS
@@ -1582,6 +1588,8 @@ for instance using the window manager, then this produces a quit and
1582 Lisp_Object x, y, frame, newpos, prompt; 1588 Lisp_Object x, y, frame, newpos, prompt;
1583 int x_coord, y_coord; 1589 int x_coord, y_coord;
1584 1590
1591 dialog_via_menu:
1592
1585 prompt = Fcar (contents); 1593 prompt = Fcar (contents);
1586 if (FRAME_WINDOW_P (f)) 1594 if (FRAME_WINDOW_P (f))
1587 { 1595 {
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/>. */
21 21
22#include "systime.h" /* for Time */ 22#include "systime.h" /* for Time */
23 23
24#ifdef HAVE_NTGUI
25extern Lisp_Object Qunsupported__w32_dialog;
26#endif
27
24extern void x_set_menu_bar_lines (struct frame *f, 28extern void x_set_menu_bar_lines (struct frame *f,
25 Lisp_Object value, 29 Lisp_Object value,
26 Lisp_Object oldval); 30 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;
98MessageBoxW_Proc unicode_message_box = NULL; 98MessageBoxW_Proc unicode_message_box = NULL;
99#endif /* NTGUI_UNICODE */ 99#endif /* NTGUI_UNICODE */
100 100
101Lisp_Object Qdebug_on_next_call; 101Lisp_Object Qdebug_on_next_call, Qunsupported__w32_dialog;
102 102
103void set_frame_menubar (struct frame *, bool, bool); 103void set_frame_menubar (struct frame *, bool, bool);
104 104
@@ -114,34 +114,44 @@ static int fill_in_menu (HMENU, widget_value *);
114 114
115void w32_free_menu_strings (HWND); 115void w32_free_menu_strings (HWND);
116 116
117#ifdef HAVE_DIALOGS
118Lisp_Object 117Lisp_Object
119w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) 118w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
120{ 119{
121 Lisp_Object title;
122 char *error_name;
123 Lisp_Object selection;
124 120
125 check_window_system (f); 121 check_window_system (f);
126 122
127 /* Decode the dialog items from what was specified. */ 123#ifndef HAVE_DIALOGS
128 title = Fcar (contents);
129 CHECK_STRING (title);
130 124
131 list_of_panes (Fcons (contents, Qnil)); 125 /* Handle simple Yes/No choices as MessageBox popups. */
126 if (is_simple_dialog (contents))
127 return simple_dialog_show (f, contents, header);
128 else
129 return Qunsupported__w32_dialog;
130#else /* HAVE_DIALOGS */
131 {
132 Lisp_Object title;
133 char *error_name;
134 Lisp_Object selection;
132 135
133 /* Display them in a dialog box. */ 136 /* Decode the dialog items from what was specified. */
134 block_input (); 137 title = Fcar (contents);
135 selection = w32_dialog_show (f, 0, title, header, &error_name); 138 CHECK_STRING (title);
136 unblock_input ();
137 139
138 discard_menu_items (); 140 list_of_panes (Fcons (contents, Qnil));
139 FRAME_DISPLAY_INFO (f)->grabbed = 0;
140 141
141 if (error_name) error (error_name); 142 /* Display them in a dialog box. */
142 return selection; 143 block_input ();
143} 144 selection = w32_dialog_show (f, 0, title, header, &error_name);
145 unblock_input ();
146
147 discard_menu_items ();
148 FRAME_DISPLAY_INFO (f)->grabbed = 0;
149
150 if (error_name) error (error_name);
151 return selection;
152 }
144#endif /* HAVE_DIALOGS */ 153#endif /* HAVE_DIALOGS */
154}
145 155
146/* Activate the menu bar of frame F. 156/* Activate the menu bar of frame F.
147 This is called from keyboard.c when it gets the 157 This is called from keyboard.c when it gets the
@@ -1621,6 +1631,7 @@ syms_of_w32menu (void)
1621 current_popup_menu = NULL; 1631 current_popup_menu = NULL;
1622 1632
1623 DEFSYM (Qdebug_on_next_call, "debug-on-next-call"); 1633 DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
1634 DEFSYM (Qunsupported__w32_dialog, "unsupported--w32-dialog");
1624 1635
1625 defsubr (&Smenu_or_popup_active_p); 1636 defsubr (&Smenu_or_popup_active_p);
1626} 1637}
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;
781 781
782#define GUI_SDATA(x) ((guichar_t*) SDATA (x)) 782#define GUI_SDATA(x) ((guichar_t*) SDATA (x))
783 783
784#if defined HAVE_DIALOGS
785extern Lisp_Object w32_popup_dialog (struct frame *, Lisp_Object, Lisp_Object); 784extern Lisp_Object w32_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
786#endif
787 785
788extern void syms_of_w32term (void); 786extern void syms_of_w32term (void);
789extern void syms_of_w32menu (void); 787extern void syms_of_w32menu (void);