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#65183: 29.1; Child frame moving and resizing problems Date: Thu, 10 Aug 2023 11:55:31 +0300 Message-ID: <837cq3jmyk.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20688"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65183@debbugs.gnu.org To: =?UTF-8?Q?=E9=99=88=E5=AE=87=E8=BF=AA?= , Po Lu , martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 10 10:56:15 2023 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 1qU1Sp-00059b-0C for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Aug 2023 10:56:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qU1Sd-0003R1-9L; Thu, 10 Aug 2023 04:56:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qU1Sc-0003Qr-4K for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 04:56:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qU1Sb-0003mw-SW for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 04:56:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qU1Sb-0005eI-PH for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 04:56:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Aug 2023 08:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65183 X-GNU-PR-Package: emacs Original-Received: via spool by 65183-submit@debbugs.gnu.org id=B65183.169165771921660 (code B ref 65183); Thu, 10 Aug 2023 08:56:01 +0000 Original-Received: (at 65183) by debbugs.gnu.org; 10 Aug 2023 08:55:19 +0000 Original-Received: from localhost ([127.0.0.1]:41340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qU1Rv-0005dG-Am for submit@debbugs.gnu.org; Thu, 10 Aug 2023 04:55:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qU1Ru-0005d0-3F for 65183@debbugs.gnu.org; Thu, 10 Aug 2023 04:55:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qU1Ro-0003gA-EE; Thu, 10 Aug 2023 04:55:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=v7cJzvAcoBAFfHxJj4aFmoFG6DRs4H2+vu9DV+dUqwU=; b=iW1OJFo8r6t/NPm1po4I 6fl4yLyJ/KFURbTpwDElzS/ZbWV/xZHtLtM56olrLvnYp9nJX0DU3/GyU5WLKM9zL5YUrFIHiTDVa 0/2ElzMMYV1TRmc0lCJ1ZK3LNJM5u/iEqxIL8lax2rGhGu4JucxF6Pdo1ToLdqT19bKbLMyKKtWJz ymPIzheNIKwkWRj7LeCKHVVvFiyJr35N9Ng6i4VUnN005qQOmJjBOnG67dHRmcSqRd+BgbcOZbdbC Gh12G2RAorsP1Ul+56j2A0Ngx6f/exbsAsut8GowbfhOGbOrXm0FJ+yHNorfziNHlbbSHpqCgBPyG RctfOZMXqUpVvA==; In-Reply-To: (message from =?UTF-8?Q?=E9=99=88=E5=AE=87=E8=BF=AA?= on Wed, 9 Aug 2023 15:28:16 +0100) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267106 Archived-At: > From: 陈宇迪 > Date: Wed, 9 Aug 2023 15:28:16 +0100 > > Start Emacs with `emacs -Q' and evaluate the following code: > > ;;;;; CODE BEGIN ;;;;; > > (defun test-child-frame () > (interactive) > (let ((f (make-frame `((parent-frame . ,(selected-frame)) > (internal-border-width . 3) > (vertical-scroll-bars . nil) > (menu-bar-lines . 0) > (tool-bar-lines . t) > (left . 20) > (top . 20) > (width . 50) > (height . 20)))) > (b (generate-new-buffer "*child-frame-test*"))) > ;; Setup the frame and the buffer. > (with-selected-frame f > (switch-to-buffer b) > (with-current-buffer b > (set-background-color "black") > (setq mode-line-format nil))) > (sit-for 0.3) > ;; inhibit redisplay > (let ((inhibit-redisplay t)) > ;; resize > (set-frame-size f 50 10) > ;; move > (set-frame-position f 20 60)) > (sit-for 0.3) > ;; clean up > (delete-frame f) > (kill-buffer b))) > > (test-child-frame) ;; Call the function defined above. > > ;;;;; CODE END ;;;;; > > I recorded what I saw and sent it as the attachment "bug_slow_motion.mp4". > Briefly, the child frame appeared, then moved downwards, and then resized. > The moving and resizing are very quick so I slowed down the video (about 10x slower). > > There are two problems: > > 1. I wrap the set size and set position code in a `(let ((inhibit-redisplay t)) ...)'. > The docstring of `inhibit-redisplay' says "Non-nil means don’t actually do any redisplay.", > but the process of setting size and setting position is displayed. Your interpretation of that variable is incomplete and inaccurate. Binding it to non-nil inhibits redisplay during the time the binding is active, but in your case redisplay happens after the function exits, when the binding is no longer in effect. The function set-frame-size doesn't call redisplay, it just modifies the frame dimension, and the next redisplay cycle then adjusts the frame accordingly, but that redisplay cycle happens after your function returns. > 2. In the code I gave, `set-frame-size' should be executed before `set-frame-position'. > But in fact, the child frame was first moved, and then resized. It is in the wrong order. I don't think you can trust the order in this case, as at least some of the actual move/resize is performed by the window-manager. Adding Po Lu and Martin, who know this stuff better than I do.