From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: 55208@debbugs.gnu.org
Subject: bug#55208: 29.0.50; MS-Windows GUI selection dialogs and double-buffering
Date: Sat, 07 May 2022 13:41:32 +0300 [thread overview]
Message-ID: <83zgjty68z.fsf@gnu.org> (raw)
In-Reply-To: <87levd7ib5.fsf@yahoo.com> (message from Po Lu on Sat, 07 May 2022 18:23:10 +0800)
> From: Po Lu <luangruo@yahoo.com>
> Cc: 55208@debbugs.gnu.org
> Date: Sat, 07 May 2022 18:23:10 +0800
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Thanks, the below seems to fix the problem here on XP. Does the patch
> > look reasonable, and if so, could you perhaps test it on some newer
> > version of Windows, to see that it doesn't cause any regressions
> > there?
>
> I don't have access to the Windows machine(s) at this time of day. The
> patch looks good to me (though I wonder what happens if a WM_PAINT
> message is received for a frame other than
> `w32_selection_dialog_open_frame')
Hmm... you are right. An updated patch below.
> and I will test it ASAP.
Thanks.
diff --git a/src/w32fns.c b/src/w32fns.c
index 0f25c1a..e5becb5 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -247,6 +247,8 @@ #define MENU_FREE_DELAY 1000
static int w32_unicode_gui;
+static bool w32_selection_dialog_open;
+
/* From w32menu.c */
int menubar_in_use = 0;
@@ -4184,6 +4186,16 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
update_rect.left, update_rect.top,
update_rect.right, update_rect.bottom));
#endif
+ /* Under double-buffering, update the frame from the back
+ buffer, to prevent a "ghost" of the selection dialog to
+ be left on display while the user selects in the dialog. */
+ if (w32_selection_dialog_open
+ && !w32_disable_double_buffering
+ && FRAME_OUTPUT_DATA (f)->paint_dc)
+ BitBlt (FRAME_OUTPUT_DATA (f)->paint_buffer_handle,
+ 0, 0, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f),
+ FRAME_OUTPUT_DATA (f)->paint_dc, 0, 0, SRCCOPY);
+
EndPaint (hwnd, &paintStruct);
leave_crit ();
@@ -7755,6 +7767,15 @@ w32_dialog_in_progress (Lisp_Object in_progress)
{
Lisp_Object frames, frame;
+ /* Indicate to w32_wnd_proc that the selection dialog is about to be
+ open (or was closed, if IN_PROGRESS is nil). */
+ if (!w32_disable_double_buffering)
+ {
+ enter_crit ();
+ w32_selection_dialog_open = !NILP (in_progress);
+ leave_crit ();
+ }
+
/* Don't let frames in `above' z-group obscure dialog windows. */
FOR_EACH_FRAME (frames, frame)
{
next prev parent reply other threads:[~2022-05-07 10:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-01 16:03 bug#55208: 29.0.50; MS-Windows GUI selection dialogs and double-buffering Eli Zaretskii
2022-05-02 1:10 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02 2:29 ` Eli Zaretskii
2022-05-02 2:41 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-07 7:40 ` Eli Zaretskii
2022-05-07 8:26 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-07 9:02 ` Eli Zaretskii
2022-05-07 9:19 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-07 10:06 ` Eli Zaretskii
2022-05-07 10:23 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-07 10:41 ` Eli Zaretskii [this message]
2022-05-08 5:33 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-08 6:26 ` 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=83zgjty68z.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=55208@debbugs.gnu.org \
--cc=luangruo@yahoo.com \
/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).