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:41:32 +0300

> 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)
     {





reply via email to

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