emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116260: Fix bug #16636 with simple dialogs on MS-Wi


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r116260: Fix bug #16636 with simple dialogs on MS-Windows.
Date: Tue, 04 Feb 2014 16:15:20 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116260
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16636
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Tue 2014-02-04 18:13:51 +0200
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/menu.c                     menu.c-20091113204419-o5vbwnq5f7feedwu-8676
  src/menu.h                     menu.h-20091113204419-o5vbwnq5f7feedwu-8702
  src/w32menu.c                  w32menu.c-20091113204419-o5vbwnq5f7feedwu-947
  src/w32term.h                  w32term.h-20091113204419-o5vbwnq5f7feedwu-954
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-02-04 11:40:31 +0000
+++ b/src/ChangeLog     2014-02-04 16:13:51 +0000
@@ -1,3 +1,23 @@
+2014-02-04  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        * keyboard.c (kbd_buffer_get_event): Read file notification events

=== modified file 'src/menu.c'
--- a/src/menu.c        2014-01-17 11:55:00 +0000
+++ b/src/menu.c        2014-02-04 16:13:51 +0000
@@ -1566,9 +1566,15 @@
     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 @@
     Lisp_Object x, y, frame, newpos, prompt;
     int x_coord, y_coord;
 
+  dialog_via_menu:
+
     prompt = Fcar (contents);
     if (FRAME_WINDOW_P (f))
       {

=== modified file 'src/menu.h'
--- a/src/menu.h        2014-01-01 07:43:34 +0000
+++ b/src/menu.h        2014-02-04 16:13:51 +0000
@@ -21,6 +21,10 @@
 
 #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);

=== modified file 'src/w32menu.c'
--- a/src/w32menu.c     2014-01-01 07:43:34 +0000
+++ b/src/w32menu.c     2014-02-04 16:13:51 +0000
@@ -98,7 +98,7 @@
 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 @@
 
 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);
-
-  list_of_panes (Fcons (contents, Qnil));
-
-  /* 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;
-}
+#ifndef HAVE_DIALOGS
+
+  /* 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;
+
+      /* Decode the dialog items from what was specified.  */
+      title = Fcar (contents);
+      CHECK_STRING (title);
+
+      list_of_panes (Fcons (contents, Qnil));
+
+      /* 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 @@
   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);
 }

=== modified file 'src/w32term.h'
--- a/src/w32term.h     2014-02-04 07:36:58 +0000
+++ b/src/w32term.h     2014-02-04 16:13:51 +0000
@@ -781,9 +781,7 @@
 
 #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);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]