all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Using Qunsupported__w32_dialog
Date: Wed, 04 Jun 2014 16:47:37 +0300	[thread overview]
Message-ID: <83r4347pmu.fsf@gnu.org> (raw)
In-Reply-To: <538F212A.2050603@yandex.ru>

> Date: Wed, 04 Jun 2014 17:37:46 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: emacs-devel@gnu.org
> 
> On 06/04/2014 05:09 PM, Eli Zaretskii wrote:
> 
> > Therefore, the snippet above should instead say something like this:
> >
> >    /* Display the popup dialog by a terminal-specific hook ... */
> >    if (FRAME_TERMINAL (f)->popup_dialog_hook)
> >      {
> >        Lisp_Object val =
> >          FRAME_TERMINAL (f)->popup_dialog_hook (f, header, contents);
> >
> >        if (!EQ (val, Qunsupported__w32_dialog))
> >          return val;
> >      }
> >
> >    /* ... or emulate it with a menu.  */
> >    return emulate_dialog_with_menu (f, contents);
> >
> > And I think this means Qunsupported__w32_dialog cannot be static.
> 
> Hm... I would like to see Qunsupported__w32_dialog as a local
> Windows-specific workaround, and let w32_popup_dialog call
> emulate_dialog_with_menu in case of unsupported dialog structure.

Why?  What does this gain us?

> So, to preserve the proposed end of Fx_popup_dialog:
> 
> /* Display the popup dialog by a terminal-specific hook ... */
> if (FRAME_TERMINAL (f)->popup_dialog_hook)
>    return FRAME_TERMINAL (f)->popup_dialog_hook (f, header, contents);
> 
> /* ... or emulate it with a menu.  */
> return emulate_dialog_with_menu (f, contents);
> 
> MS-Windows stuff should be:
> 
> Lisp_Object
> w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents)
> {
>    Lisp_Object selection;
> 
>    check_window_system (f);
> 
> #ifndef HAVE_DIALOGS
>    /* Handle simple Yes/No choices as MessageBox popups.  */
>    if (is_simple_dialog (contents))
>      selection = simple_dialog_show (f, contents, header);
>    else
>      selection = Qunsupported__w32_dialog;
> #else  /* HAVE_DIALOGS */
>      {
>        Lisp_Object title;
>        char *error_name;
> 
>        /* 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, title, header, &error_name);
>        unblock_input ();
> 
>        discard_menu_items ();
>        FRAME_DISPLAY_INFO (f)->grabbed = 0;
> 
>        if (error_name) error (error_name);
>      }
> #endif /* HAVE_DIALOGS */
>      return (EQ (selection, Qunsupported__w32_dialog) ?
> 	    emulate_dialog_with_menu (f, contents) : selection);
> }
> 
> IIUC this should have the same behavior as the old code, isn't it?

More or less, but how is this better?  For starters, you now have
emulate_dialog_with_menu extern instead of static, and it is called
from 2 places rather than one.  I don't see the gain here.

I can put the explanation of why we need Qunsupported__w32_dialog in
comments, if that would help.

Btw, the part of your patch that does this:

@@ -148,6 +149,8 @@
       FRAME_DISPLAY_INFO (f)->grabbed = 0;
 
       if (error_name) error (error_name);
+      if (EQ (selection, Qunsupported__w32_dialog))
+	return emulate_dialog_with_menu (f, contents);
       return selection;
     }
 #endif /* HAVE_DIALOGS */

is unnecessary: the HAVE_DIALOGS code will never return this special
value.



  reply	other threads:[~2014-06-04 13:47 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 20:00 Latest EMACS on BZR trunk does not compile with MinGW Vincent Belaïche
2014-06-03 20:22 ` Paul Eggert
2014-06-03 20:56   ` Óscar Fuentes
2014-06-03 21:15   ` Eli Zaretskii
2014-06-03 21:21     ` Vincent Belaïche
2014-06-04  6:47       ` Eli Zaretskii
2014-06-04 13:17         ` Vincent Belaïche
2014-06-04 13:31           ` Eli Zaretskii
2014-06-04 15:28             ` Vincent Belaïche
2014-06-04 15:44               ` Eli Zaretskii
2014-06-04 15:54                 ` Dani Moncayo
2014-06-04 16:05                   ` Eli Zaretskii
2014-06-04 21:50                     ` Dani Moncayo
2014-06-05  0:42                       ` Stefan Monnier
2014-06-05  2:51                         ` Eli Zaretskii
2014-06-05  3:40                           ` Óscar Fuentes
2014-06-05  7:03                             ` Dani Moncayo
2014-06-05  9:03                               ` Vincent Belaïche
2014-06-05 15:09                                 ` Eli Zaretskii
2014-06-05 14:51                             ` Eli Zaretskii
2014-06-05 16:19                               ` Óscar Fuentes
2014-06-05 17:52                                 ` Eli Zaretskii
2014-06-05 13:31                           ` Stefan Monnier
2014-06-05 15:15                             ` Eli Zaretskii
2014-06-05 16:50                               ` Stefan Monnier
2014-06-05 18:07                                 ` Eli Zaretskii
2014-06-05 19:35                                   ` Paul Eggert
2014-06-05 19:54                                     ` Eli Zaretskii
2014-06-10 19:25                                     ` Dani Moncayo
2014-06-10 20:21                                       ` Eli Zaretskii
2014-06-05 20:54                                   ` Stefan Monnier
2014-06-05  2:47                       ` Eli Zaretskii
2014-06-04 12:22     ` Using Qunsupported__w32_dialog Dmitry Antipov
2014-06-04 13:09       ` Eli Zaretskii
2014-06-04 13:37         ` Dmitry Antipov
2014-06-04 13:47           ` Eli Zaretskii [this message]
2014-06-04 14:06             ` Eli Zaretskii
2014-06-03 21:14 ` Latest EMACS on BZR trunk does not compile with MinGW Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r4347pmu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.