unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
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:06:47 +0300	[thread overview]
Message-ID: <834k21zmfc.fsf@gnu.org> (raw)
In-Reply-To: <87pmkp7l9l.fsf@yahoo.com> (message from Po Lu on Sat, 07 May 2022 17:19:18 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: 55208@debbugs.gnu.org
> Date: Sat, 07 May 2022 17:19:18 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > That's what I said: w32_msg_pump doesn't currently handle WM_PAINT, it
> > only handles WM_EMACS_* messages we send to it.  Did you mean
> > w32_wnd_proc instead?  Or what am I missing?
> 
> Silly me!  I did indeed mean `w32_wnd_proc'.

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?

diff --git a/src/w32fns.c b/src/w32fns.c
index 0f25c1a..d2da943 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -247,6 +247,8 @@ #define MENU_FREE_DELAY 1000
 
 static int w32_unicode_gui;
 
+static struct frame *w32_selection_dialog_open_frame = NULL;
+
 /* 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_frame == f
+		&& !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 ();
 
@@ -7754,6 +7766,16 @@ file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 w32_dialog_in_progress (Lisp_Object in_progress)
 {
   Lisp_Object frames, frame;
+  struct frame *f = SELECTED_FRAME ();
+
+  /* If the current frame has double-buffering enabled, indicate to
+     w32_wnd_proc that the selection dialog is about to be open.  */
+  if (FRAME_OUTPUT_DATA (f)->want_paint_buffer)
+    {
+      enter_crit ();
+      w32_selection_dialog_open_frame = NILP (in_progress) ? NULL : f;
+      leave_crit ();
+    }
 
   /* Don't let frames in `above' z-group obscure dialog windows.  */
   FOR_EACH_FRAME (frames, frame)





  reply	other threads:[~2022-05-07 10:06 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 [this message]
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
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=834k21zmfc.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).