From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#11732: Follow-up to bug#11732 Date: Fri, 29 Jun 2018 12:07:16 +0300 Message-ID: <83fu16nepn.fsf@gnu.org> References: <87obohkxga.fsf@XAVIER-PC.i-did-not-set--mail-host-address--so-tickle-me> <83y3f0p6n7.fsf@gnu.org> <5B35F120.9040807@gmx.at> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1530263166 25995 195.159.176.226 (29 Jun 2018 09:06:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 29 Jun 2018 09:06:06 +0000 (UTC) Cc: 11732@debbugs.gnu.org, mhatta@gmail.com To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 29 11:06:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fYpLt-0006fH-Fr for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Jun 2018 11:06:01 +0200 Original-Received: from localhost ([::1]:40725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYpO0-0005it-LK for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Jun 2018 05:08:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYpNu-0005iV-19 for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2018 05:08:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYpNq-0003DG-Rh for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2018 05:08:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59586) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYpNq-0003D4-O5 for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2018 05:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fYpNq-00022h-GK for bug-gnu-emacs@gnu.org; Fri, 29 Jun 2018 05:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jun 2018 09:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11732 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 11732-submit@debbugs.gnu.org id=B11732.15302632407803 (code B ref 11732); Fri, 29 Jun 2018 09:08:02 +0000 Original-Received: (at 11732) by debbugs.gnu.org; 29 Jun 2018 09:07:20 +0000 Original-Received: from localhost ([127.0.0.1]:39250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fYpNA-00021n-EY for submit@debbugs.gnu.org; Fri, 29 Jun 2018 05:07:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48417) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fYpN8-00021Z-Ez for 11732@debbugs.gnu.org; Fri, 29 Jun 2018 05:07:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYpMz-0002Cr-Uw for 11732@debbugs.gnu.org; Fri, 29 Jun 2018 05:07:13 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYpMz-0002CZ-QK; Fri, 29 Jun 2018 05:07:09 -0400 Original-Received: from [176.228.60.248] (port=1907 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fYpMz-0002DT-8H; Fri, 29 Jun 2018 05:07:09 -0400 In-reply-to: <5B35F120.9040807@gmx.at> (message from martin rudalics on Fri, 29 Jun 2018 10:43:12 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:147951 Archived-At: > Date: Fri, 29 Jun 2018 10:43:12 +0200 > From: martin rudalics > 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. */