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:41:32 +0300 Message-ID: <83zgjty68z.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> <834k21zmfc.fsf@gnu.org> <87levd7ib5.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12225"; 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:48:57 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 1nnHzd-000349-1l for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 May 2022 12:48:57 +0200 Original-Received: from localhost ([::1]:59630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnHza-0004rv-2t for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 07 May 2022 06:48:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnHsw-000197-Pk for bug-gnu-emacs@gnu.org; Sat, 07 May 2022 06:42:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnHsw-0003G8-Fc for bug-gnu-emacs@gnu.org; Sat, 07 May 2022 06:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnHsw-000345-Cr for bug-gnu-emacs@gnu.org; Sat, 07 May 2022 06:42: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:42: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.165192011011760 (code B ref 55208); Sat, 07 May 2022 10:42:02 +0000 Original-Received: (at 55208) by debbugs.gnu.org; 7 May 2022 10:41:50 +0000 Original-Received: from localhost ([127.0.0.1]:50587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnHsj-00033b-OD for submit@debbugs.gnu.org; Sat, 07 May 2022 06:41:50 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnHsh-00033O-Rz for 55208@debbugs.gnu.org; Sat, 07 May 2022 06:41:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnHsc-0003ET-Ii; Sat, 07 May 2022 06:41:42 -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=yBKzp0Nkl2MEc7tsfzqphqKgQCH6cM+tHNifFloj1xo=; b=Gk4xt7yjnF6g dgTeTiAn4h7dQQOSe3bnO9w/Ujo9DpL6XPIX+iZUoippSW1gkKVFbgpcnvUVnrrfZ2u6BVM0YGcoD F7/qb/Tqp0RGcKVYWT/cJSMG7vXuaZyoDzz9JwaTRo7EO5ilhUET/l8OqqVZPDSKArStPl3t9oI45 Wxcdj0OCCSol+duVx4DapSs3USY2wsexk2Zp8ZtxnJv2JyaOk0b4KwCE0ffRCP1d042YpbJfyUuF7 U9Jj4Iqgt6BNKc+NOsG5fGbwllL9lImNNsBJDZSjgPXjGDvWx/I0GPcMnysyKMr8HFhNSUy0LbtgU XiUR4n4l/qnMabl5GrRC3Q==; Original-Received: from [87.69.77.57] (port=1568 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 1nnHsb-0003in-UR; Sat, 07 May 2022 06:41:42 -0400 In-Reply-To: <87levd7ib5.fsf@yahoo.com> (message from Po Lu on Sat, 07 May 2022 18:23:10 +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:231572 Archived-At: > From: Po Lu > Cc: 55208@debbugs.gnu.org > Date: Sat, 07 May 2022 18:23:10 +0800 > > Eli Zaretskii 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) {