From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=E9=99=88=E5=AE=87=E8=BF=AA?= Newsgroups: gmane.emacs.bugs Subject: bug#65183: 29.1; Child frame moving and resizing problems Date: Sun, 13 Aug 2023 14:34:15 +0100 Message-ID: References: <837cq3jmyk.fsf@gnu.org> <13c2f66e-861d-2ab3-6405-a2b57b29863b@gmx.at> <03272821-c79f-5e57-c368-f06baf050200@gmx.at> <4a241eb8-2ac7-78b4-a6ce-bf7b9a1c477b@gmx.at> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000360a370602ce01b7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14107"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , 65183@debbugs.gnu.org, Eli Zaretskii To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 13 16:10:24 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 1qVBnT-0003Vd-Rk for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Aug 2023 16:10:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVBnB-0007UE-97; Sun, 13 Aug 2023 10:10:05 -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 1qVBn9-0007TS-Lx for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2023 10:10:03 -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 1qVBn9-0000OL-68 for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2023 10:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qVBn8-0002SO-SQ for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2023 10:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=E9=99=88=E5=AE=87=E8=BF=AA?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Aug 2023 14:10:02 +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.16919357819398 (code B ref 65183); Sun, 13 Aug 2023 14:10:02 +0000 Original-Received: (at 65183) by debbugs.gnu.org; 13 Aug 2023 14:09:41 +0000 Original-Received: from localhost ([127.0.0.1]:60064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVBmm-0002RU-2E for submit@debbugs.gnu.org; Sun, 13 Aug 2023 10:09:41 -0400 Original-Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:49421) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVBEm-0000xQ-QF for 65183@debbugs.gnu.org; Sun, 13 Aug 2023 09:34:34 -0400 Original-Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3a7781225b4so2948983b6e.3 for <65183@debbugs.gnu.org>; Sun, 13 Aug 2023 06:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691933667; x=1692538467; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dorkl25NANvnjxkRI1cGohHEFzuDiA0y3ICevlJ+8yQ=; b=hdh9jC9rK23j9s2bgB8PC6UVJ94JsiIjzpaM4+Zl2S6YCEUDYUZnj2sbvN8aEKZgLt 0AB0qX6wtdnRVtw20amuOwTLPB/8GwDgPDVb9dUHlX0EZf6J2EWYmzXaDsepmJSp9qbl eEJzdw5nxjHplyzGgZ1RSqcu9bDNNxwkS50sNeK7FJsic6R4AVxIAakMPaS30+GLxNCb izgZTvDjnxtzsTE9ySgV849C0lf6UZ+TH4KoPHDoPc4elVOqbrkqYr3sKjTZTrnKlQ4K zdJIzzYno0mXYzAw4z5AborqvJzH65dr/1ow4MNuLPPawBS13fmpXRHYBlIeUspm3B+B qgPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691933667; x=1692538467; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dorkl25NANvnjxkRI1cGohHEFzuDiA0y3ICevlJ+8yQ=; b=A1sXygxqKOq0h6nE7WZ9AjUDoHHnssm80pe7l3rtu36oyv7E6OacoHGR+vWhsPzT3i OBqOCewgXkhqEKirTkVaDUElsPY71JrOm5JqpsS/fj/EfV0KJf+kfrY7PmA9tINdhyUY ev24O1K8hIlQUJtHGAk5ckYkXviChLj6H+3PcnxSuZsBbAUMkQAJdoug1UxvjQLXDbqP t6gLAsQUqt1+ylcMuxJFdU9NTsnstHAN2mUKAnHycfOj+OzmP2JUrsElXiq49/1X67B4 Kd/iP0w60TAB1GbSSno86/73giML89/C45Mk/uWmH/GsIEc+5zd5Y8W/wRBlxOH08epF Co+w== X-Gm-Message-State: AOJu0YzvbG/0ejfBh0Lv3M5HtyxYHT3DNaAKBykEjeqerZzcBnqQJ3S9 dpikL8bDkkziUZXgrUPOnPPl+BDBzHINuxhekfc= X-Google-Smtp-Source: AGHT+IGuYpbrSvHn0wkd5Rh06SltXEDvPYBaVkgTVapsQWtO4Fc95JM09kzGwjuffjnzP+xk30DCofB+CxDwRmlZqCQ= X-Received: by 2002:a05:6808:159b:b0:3a7:5ae:100f with SMTP id t27-20020a056808159b00b003a705ae100fmr8294535oiw.43.1691933667099; Sun, 13 Aug 2023 06:34:27 -0700 (PDT) In-Reply-To: <4a241eb8-2ac7-78b4-a6ce-bf7b9a1c477b@gmx.at> X-Mailman-Approved-At: Sun, 13 Aug 2023 10:09:37 -0400 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:267367 Archived-At: --000000000000360a370602ce01b7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Since I'm not familiar with Emacs' source code and the ideas, I find it difficult to write the patch code that has fewer duplicates, covers all corner cases, and is easy to maintain. So, I decided not to write this code. But I'm sure the resize and move functions can solve the issue that I mentioned in my first email, based on my tests. By the way, I suggest naming the function to add as `set-frame-position-and-size' instead of `set-frame-size-and-position', because most underlying APIs are called xxx_move_resize_xxx: `gdk_window_move_resize' (GTK), `XMoveResizeWindow' (X11), `MoveWindow(hWnd, X, Y, nWidth, nHeight, bRepaint)' (Windows). martin rudalics =E4=BA=8E2023=E5=B9=B48=E6=9C=8813=E6=97= =A5=E5=91=A8=E6=97=A5 08:21=E5=86=99=E9=81=93=EF=BC=9A > > But there is one thing that I don't know what the best solution is: ho= w > to > > reuse the code > > in the function `adjust_frame_size' (defined in src/frame.c, used by > > `set-frame-size')? > > I want to add two arguments: `new_x' and `new_y'. When `new_x' and > `new_y' > > are the > > same with the current frame position, > > ... with GNOME/mutter it's hard to tell but that shouldn't bother us > here ... > > > execute the original branch > > (`set_window_size_hook' > > or `resize_frame_window'); otherwise, call a move and resize function. > > But I have to rename this function to `adjust_frame_position_and_size'= . > For > > compatibility, > > Alternatively you could put new_x and new_y together with an identifier > (say 'size_and_position') into PARAMETER and extract them before running > the hook. INHIBIT would be 1 anyway, so frame_inhibit_resize is of no > concern here. > > > I will also create a wrapper function called `adjust_frame_size', in > which > > `adjust_frame_position_and_size' is called with the current frame > position > > as the last two args > > This is the crucial point - rewriting all those adjust_frame_size calls > would be a great pain. > > > so that the frame will be only resized but not moved. > > Do you think this is an appropriate solution? > > I think so, yes. > > Before coding other backends of set_window_size_hook make sure that the > code gives the desired results on your own system to avoid writing them > without any gain. > > martin > --000000000000360a370602ce01b7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Since I'm not familiar with Emacs' source cod= e and the ideas, I find it difficult
to write the patch code that has fewer duplicates, covers all corner= cases,=C2=A0
and is easy to maintain. So, I decided not to wri= te this code.

But I'm sure the resize and move= functions can solve the issue that I mentioned
in my first email= , based on my tests.

By the way, I suggest naming = the function to add as `set-frame-position-and-size'
instead = of `set-frame-size-and-position', because most underlying APIs are call= ed
xxx_move_resize_xxx: `gdk_window_move_resize'= (GTK), `XMoveResizeWindow' (X11),
`MoveWindow(hWnd, X, Y, nW= idth, nHeight, bRepaint)' (Windows).

martin rudalics <rudalics@gmx.at> =E4=BA=8E2023=E5=B9= =B48=E6=9C=8813=E6=97=A5=E5=91=A8=E6=97=A5 08:21=E5=86=99=E9=81=93=EF=BC=9A=
=C2=A0> But = there is one thing that I don't know what the best solution is: how to<= br> =C2=A0> reuse the code
=C2=A0> in the function `adjust_frame_size' (defined in src/frame.c,= used by
=C2=A0> `set-frame-size')?
=C2=A0> I want to add two arguments: `new_x' and `new_y'. When= =C2=A0 `new_x' and `new_y'
=C2=A0> are the
=C2=A0> same with the current frame position,

... with GNOME/mutter it's hard to tell but that shouldn't bother u= s
here ...

=C2=A0> execute the original branch
=C2=A0> (`set_window_size_hook'
=C2=A0> or `resize_frame_window'); otherwise, call a move and resize= function.
=C2=A0> But I have to rename this function to `adjust_frame_position_and= _size'. For
=C2=A0> compatibility,

Alternatively you could put new_x and new_y together with an identifier
(say 'size_and_position') into PARAMETER and extract them before ru= nning
the hook.=C2=A0 INHIBIT would be 1 anyway, so frame_inhibit_resize is of no=
concern here.

=C2=A0> I will also create a wrapper function called `adjust_frame_size&= #39;, in which
=C2=A0> `adjust_frame_position_and_size' is called with the current = frame position
=C2=A0> as the last two args

This is the crucial point - rewriting all those adjust_frame_size calls
would be a great pain.

=C2=A0> so that the frame will be only resized but not moved.
=C2=A0> Do you think this is an appropriate solution?

I think so, yes.

Before coding other backends of set_window_size_hook make sure that the
code gives the desired results on your own system to avoid writing them
without any gain.

martin
--000000000000360a370602ce01b7--