unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: 11732@debbugs.gnu.org, mhatta@gmail.com
Subject: bug#11732: Follow-up to bug#11732
Date: Fri, 29 Jun 2018 12:07:16 +0300	[thread overview]
Message-ID: <83fu16nepn.fsf@gnu.org> (raw)
In-Reply-To: <5B35F120.9040807@gmx.at> (message from martin rudalics on Fri, 29 Jun 2018 10:43:12 +0200)

> Date: Fri, 29 Jun 2018 10:43:12 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: 11732@debbugs.gnu.org
> 
> I now tried on my standard XP machine and do not see any adverse
> effects with file, directory and font dialog boxes.  Maybe it's
> related to the fact that I have "focus follows mouse" plus
> "autoraise".  Could you try with such a setting?

Will do, just not today.

>  > +	  SetWindowPos (dialog, HWND_TOPMOST, 0, 0, 0, 0,
>  > +			SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE
>  > +			| SWP_NOOWNERZORDER);
>  > +	  SetWindowPos (FRAME_W32_WINDOW (SELECTED_FRAME ()),
>  > +			dialog, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
> 
> What was the more or less precise rationale for this unless it was
> pure experimenting (in particular the SWP_NOACTIVATE in the first
> call)?

SWP_NOACTIVATE was just a copy-paste from similar calls elsewhere.
The rationale for the code was to tell windows to put the frame from
which the file-selection dialog popped behind the dialog.  If
w32_dialog_in_progress is meant to do that, I don't understand how it
does that; can you explain?

(Btw, as long as we are discussing this: the above-suspended value of
the z-group frame parameter appears to be completely undocumented.)

> The patch does not have any (adverse) effects here so if it
> solves the problem for you, I see no problem applying it.

OK.

>  > then how do
>  > we solve a similar problem in x-select-font?  It doesn't have a
>  > callback function, and if I try adding one, the appearance of the
>  > dialog changes(??) and the OK and CANCEL buttons no longer work.
> 
> Can you send me the code you tried?

Below.  It's possible I've put the code in the wrong WM_* message, but
I'm really stabbing in the dark in these matters.

> In w32_dialog_in_progress I tried to solve a relatively simple
> problem: When a frame is in the TOPMOST group and I start a dialog,
> that frame would obscure the dialog box.  So I temporarily remove the
> frame from the TOPMOST group and move it back when the dialog ends.

Can you show me some Lisp to try this situation?

Here's the patch I used with the font-selection dialog:

--- src/w32font.c~	2018-01-03 13:09:26.000000000 +0200
+++ src/w32font.c	2018-06-27 18:19:04.140101200 +0300
@@ -2505,6 +2505,24 @@ compute_metrics (HDC dc, struct w32font_
     metrics->status = W32METRIC_FAIL;
 }
 
+static UINT_PTR CALLBACK
+font_dialog_callback (HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+  static HWND cf_hwnd;
+
+  if (msg == WM_INITDIALOG)
+    cf_hwnd = ((CHOOSEFONT *)lParam)->hwndOwner;
+
+  if (msg == WM_NOTIFY)
+    {
+      SetWindowPos (hdlg, HWND_NOTOPMOST, 0, 0, 0, 0,
+		    SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE
+		    | SWP_NOOWNERZORDER);
+      SetWindowPos (cf_hwnd, hdlg, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+    }
+  return 0;
+}
+
 DEFUN ("x-select-font", Fx_select_font, Sx_select_font, 0, 2, 0,
        doc: /* Read a font name using a W32 font selection dialog.
 Return fontconfig style font string corresponding to the selection.
@@ -2527,7 +2545,8 @@ in the font selection dialog. */)
 
   cf.lStructSize = sizeof (cf);
   cf.hwndOwner = FRAME_W32_WINDOW (f);
-  cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS | CF_NOVERTFONTS;
+  cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS | CF_NOVERTFONTS | CF_ENABLEHOOK;
+  cf.lpfnHook = font_dialog_callback;
 
   /* If exclude_proportional is non-nil, limit the selection to
      monospaced fonts.  */





  reply	other threads:[~2018-06-29  9:07 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-18  5:20 bug#11732: 24.1; Microsoft IME Japanese input problem xavier.dahan
2015-02-17 10:26 ` Fujii Hironori
2015-02-18 15:17   ` Eli Zaretskii
2015-02-19  2:03     ` Fujii Hironori
2015-02-19  6:44       ` Eli Zaretskii
     [not found]         ` <CALus1PmqiC8TnQTfcpVFD5ObjqbK_4hkOczRKmG1=+mkWXUHWQ@mail.gmail.com>
2015-02-19 11:44           ` Eli Zaretskii
2015-03-06 20:29             ` Eli Zaretskii
2015-03-06 22:37               ` Fujii Hironori
2015-03-07 10:53                 ` Eli Zaretskii
2015-03-09  2:13               ` Fujii Hironori
2015-03-09 16:30                 ` Eli Zaretskii
2018-06-26  9:10 ` bug#11732: Follow-up to bug#11732 Masayuki Hatta
2018-06-27 15:54   ` Eli Zaretskii
2018-06-28  8:04     ` martin rudalics
2018-06-28 10:13       ` Masayuki Hatta
2018-06-28 12:25         ` martin rudalics
2018-06-28 13:09           ` Eli Zaretskii
2018-06-28 10:11     ` Masayuki Hatta
2018-06-28 13:28       ` Eli Zaretskii
2018-06-28 19:17         ` Noam Postavsky
2018-06-28 19:24           ` Eli Zaretskii
2018-06-29  7:39             ` Masayuki Hatta
2018-06-29  8:43               ` martin rudalics
2018-06-29  8:59                 ` Eli Zaretskii
2018-06-30  3:14                 ` Masayuki Hatta
2018-06-30  7:46                   ` Eli Zaretskii
2018-06-30  8:30                     ` Masayuki Hatta
2018-06-29  8:56               ` Eli Zaretskii
2018-06-29  8:43     ` martin rudalics
2018-06-29  9:07       ` Eli Zaretskii [this message]
2018-06-30  8:06         ` martin rudalics
2018-06-30 11:32           ` Eli Zaretskii
2018-06-30 12:51             ` martin rudalics
2018-06-30 13:21               ` Eli Zaretskii
2018-07-01  9:00                 ` martin rudalics
2018-07-01 14:29                   ` Eli Zaretskii
2018-07-03  8:29                     ` martin rudalics
2018-07-03 18:50                       ` Eli Zaretskii
2018-07-07  7:45                         ` Tak Kunihiro
2018-07-07 10:00                           ` Eli Zaretskii
2018-07-07 10:21                             ` martin rudalics
2018-07-07 11:32                               ` Eli Zaretskii
2018-07-01 14:34             ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83fu16nepn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=11732@debbugs.gnu.org \
    --cc=mhatta@gmail.com \
    --cc=rudalics@gmx.at \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).