From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#55208: 29.0.50; MS-Windows GUI selection dialogs and double-buffering Date: Sat, 07 May 2022 13:06:47 +0300 Message-ID: <834k21zmfc.fsf@gnu.org> References: <83mtg15jg9.fsf@gnu.org> <87levkpwma.fsf@yahoo.com> <83czgpzt7n.fsf@gnu.org> <87tua17npc.fsf@yahoo.com> <838rrdzpdz.fsf@gnu.org> <87pmkp7l9l.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24076"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55208@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 07 12:08:32 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnHMV-00069y-Nj for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 May 2022 12:08:32 +0200 Original-Received: from localhost ([::1]:43068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnHMT-0007xh-WD for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 May 2022 06:08:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnHM2-0007xJ-FH for bug-gnu-emacs@gnu.org; Sat, 07 May 2022 06:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnHM2-0006e0-6u for bug-gnu-emacs@gnu.org; Sat, 07 May 2022 06:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnHM2-00065J-28 for bug-gnu-emacs@gnu.org; Sat, 07 May 2022 06: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: Sat, 07 May 2022 10:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55208 X-GNU-PR-Package: emacs Original-Received: via spool by 55208-submit@debbugs.gnu.org id=B55208.165191802623324 (code B ref 55208); Sat, 07 May 2022 10:08:02 +0000 Original-Received: (at 55208) by debbugs.gnu.org; 7 May 2022 10:07:06 +0000 Original-Received: from localhost ([127.0.0.1]:50495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnHL7-000648-M8 for submit@debbugs.gnu.org; Sat, 07 May 2022 06:07:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnHL6-00063e-7J for 55208@debbugs.gnu.org; Sat, 07 May 2022 06:07:04 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36160) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnHL0-0006WU-W8; Sat, 07 May 2022 06:06:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=0YxTnwE6O8jmsYmXGh9XCDP7fAQ2UwVGvfQHtkta7Rs=; b=aTUBWO7YZAx8 JewRkzl5/0Tw8yE7+M+ISxqfNHJDtLZE8QZqz+Y2/qymGEh+DgzgrYwEiDdfVSR8TxzpbijxW9D5g VoDJYwISXhBMJJSoA+SIRQIs6PA8AJ2xwgwgsNqjYpZJ3JKHTqsmRzKtdbMb9ecqCuRYtWdJBxSjL RQov9oZL/58O53zuio2ud9NQK5CdIq7zgcVNkD4pdn3WZiHcEcFO+gNAyDEgu3MV9LgJ+/BH3ea/f Py0/s4HYoWVDJSgRXPV9jDDerF0bh+QfB9gzJGog5K7eBTcqKgJhbJaPhrGktEUYpnRj3RKcJ2suw Ot2nf0QSDOBOBBBjOod1mw==; Original-Received: from [87.69.77.57] (port=3401 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnHKz-0003k1-G7; Sat, 07 May 2022 06:06:58 -0400 In-Reply-To: <87pmkp7l9l.fsf@yahoo.com> (message from Po Lu on Sat, 07 May 2022 17:19:18 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:231562 Archived-At: > From: Po Lu > Cc: 55208@debbugs.gnu.org > Date: Sat, 07 May 2022 17:19:18 +0800 > > Eli Zaretskii 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)