bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#55208: 29.0.50; MS-Windows GUI selection dialogs and double-bufferin


From: Eli Zaretskii
Subject: bug#55208: 29.0.50; MS-Windows GUI selection dialogs and double-buffering
Date: Sat, 07 May 2022 13:06:47 +0300

> 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 via email to

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