emacs-devel
[Top][All Lists]
Advanced

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

Re: Using Qunsupported__w32_dialog


From: Eli Zaretskii
Subject: Re: Using Qunsupported__w32_dialog
Date: Wed, 04 Jun 2014 16:09:42 +0300

> Date: Wed, 04 Jun 2014 16:22:00 +0400
> From: Dmitry Antipov <address@hidden>
> CC: address@hidden
> 
> could you please review this? This is similar to r117255 but for
> popup dialogs, and Qunsupported__w32_dialog really confuses me
> (especially taking into account that I can't build for MS-Windows).

The patch looks good, except for one gotcha:

> +  /* 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);

This is incorrect for MS-Windows (and is indeed related to the
Qunsupported__w32_dialog thingy).

The problem here is that Emacs on MS-Windows does support dialogs, but
only "simple" ones, those that have only Yes/No choices.  Dialogs that
require more alternatives, or alternatives other than Yes/No, are not
yet supported (the relevant code is incomplete and ifdef'ed away).
Since many dialogs used by Emacs _are_ "simple", we don't want to lose
support for these dialogs, and so the popup_dialog_hook should not be
NULL on Windows.  So instead we do provide w32_popup_dialog, but if it
encounters a dialog structure it cannot support, it returns a special
value 'unsupported--w32-dialog', which is a signal for the caller
(x-popup-dialog) to call the emulation routine instead.

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.

Thanks.



reply via email to

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