From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Proposing changes to adjust_frame_size Date: Sun, 9 May 2021 10:41:00 +0200 Message-ID: <726883d4-8d13-a3cb-30b7-a74c4b44f8ed@gmx.at> References: <69a5e928-2998-f776-fa0d-f35e6ab1e65d@gmx.at> <20210505.194756.2198057137743556501.masm@luna.pink.masm11.me> <20210505.230733.1330791046879877132.masm@luna.pink.masm11.me> <87a6p9knr9.fsf@gnu.org> <9712b3f0-c442-61fc-93a6-773ffcde1c2e@gmx.at> <87y2cswam6.fsf@gnu.org> <1b11ac72-6687-f2d4-1d9f-0619d6d2462c@gmx.at> <87v97ww8h4.fsf@gnu.org> <87eaa667-b3cd-0274-669c-3cb4e0076ce0@gmx.at> <87sg30vy7w.fsf@gnu.org> <87pmy3x620.fsf@gnu.org> <52a5361a-451e-7167-edfd-09066dfdcc3e@gmx.at> <875yzt907k.fsf@gnu.org> <0633b8ac-de8e-b57a-f3f4-804c5efb009a@gmx.at> <874kfdtj5l.fsf@gnu.org> <37f3ce19-d858-111e-a5aa-06c24803e17b@gmx.at> <87v97tvt7e.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------018C670F25B02CF28A967367" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40874"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 09 10:41:53 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lff0b-000AXd-Ne for ged-emacs-devel@m.gmane-mx.org; Sun, 09 May 2021 10:41:53 +0200 Original-Received: from localhost ([::1]:40974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lff0a-0006Kk-QT for ged-emacs-devel@m.gmane-mx.org; Sun, 09 May 2021 04:41:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfezz-0005gD-8q for emacs-devel@gnu.org; Sun, 09 May 2021 04:41:15 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:35415) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfezp-0008U8-Rg; Sun, 09 May 2021 04:41:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620549662; bh=ssfHoILtNnOksBt61zUM3mbPf6++OzmQPILAoRw+8LA=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=Uh0agcuiGXD94uYspvvOQCWbAvxKFinV37hvSQxHHzbe4LeWz4M+T0ZKcRtdJPD4i 0HnOrr4OgBgOezWfBJt65i580YhFst02aTmc6LNXqbb6cRcujRW9dh2kLwbCvlyrnM 7g/lfSUrGXsldxRj7sgKigGCkuoxn2urKxRXMtFE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([213.142.96.220]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mz9Ux-1lImz71QlH-00wGsE; Sun, 09 May 2021 10:41:02 +0200 In-Reply-To: <87v97tvt7e.fsf@gnu.org> Content-Language: en-US X-Provags-ID: V03:K1:2aLizl5mEHkQ8vusfka1ZW4Xq5NbkPEcp+RO3xrsWWjbmnhcXY4 CtlC/0s2mf826ALuFVjgpnXJjFWIgotlb5hWFZi6Qv3V0llSlZPfQcpXBoFxt+R4w5A3vqK EfPAp/8YkkdO8R42BWUGuUYTHR4vWRuwmD3lqxOgaFoz3W+mi8e05dPGIEPpqJxNxm+XGF3 dXDDSgTrHRzAt/q7jzYAg== X-UI-Out-Filterresults: notjunk:1;V03:K0:hPVYPbJh5V4=:pZpVBESqTuOLhsCuF6ea3l +CPK5QjdJLTs8Z7W7TWlKTbOofTux8OBanhGgaOJfCL+paSLx5eE+6XHlUiCO9OSpG5ylrYSC CEnC0y5gsuLxB2Huqe48p3Dyheqp6Sbtu9suG3n47gQ5zyLHiLzg13TJQuV1lx1JwL4oYJDkJ 2l36IX/ws+aTNBnLhjLe1/OvtJnd/NJuaYFegHndKi4gf+bK04CSjRi5XiuGvP76HEixu8q9c y/Ti3Ldaf+Cn75q25ct+HiFwK2iUWNycz8G9f2RzK4sf4HxuHdNO+VnADQ4gwyoWk90SmD/6L Usbg4TzMeYhAc1nWi8+0z4H9Gj4dQifNCRIikVAXOhkQZIa4wwKL2ypVFbC6HcNLnDgexvBqB ZB86TX5+b40L2cf3363FZupgUcfL185GAD7VK6SgM7zQnKt/oG8zvkj6vOWVGfvzfrQzlSBu6 Bkm5EvQdLq2OH4FTtysQFFxkaNedxBfJk0rZGPUwNsLgBMrUeB5vFbWPQ3cCb5QNRdoYMNh// +cbGHXdUC1lRrkv0CrOrXigrzkETPteuiceDskdIoCaIJ7M79RCfOS+P1gT1Lu7fZp7W8ZNmD XQ2Oin0NsL89JMAnnuML5sAMPCI14vRdaer9nFdXCQH+oLcU1vUsqz7GP8mz0bFqjZRKwnV99 fAaeANe/OTW+9r+9L7wAD2jtHlLsRmLajhVuQIsgM0f9fwerrZlGdJV6GAhYCu37LKcArLFBD jWNAKIxbqvZA4Vp9ii7e5JnvdKddrts9zCBewdI0SxDs4B293lyZmmjeOv3IgLhnrcADTt6z Received-SPF: pass client-ip=212.227.17.22; envelope-from=rudalics@gmx.at; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:269071 Archived-At: This is a multi-part message in MIME format. --------------018C670F25B02CF28A967367 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit >> But thhis last ConfigureNotify event is not explicable to me, values >> like 789x845 are unprecedented so far. Does your WM deliberately >> resize the frame? > > Yes, pretty much like Emacs splits windows into two balanced halves. I > have a 1600 pixel wide screen, 3 pixels gap between WM windows, and 3 > pixel window borders. That makes 1579 pixels width for actual WM > windows, divided by two (I've had a terminal at the left and emacs at > the right), makes 789.5 pixels per window. Elementary. But why should it react so allergically to our resize request? Basically, we have no choice: For some "normal" WMs we have to tell them the size we want when the frame is mapped because before that they may ignore our resize requests and after that the frame has already appeared with its wrong size. For a tiling WM requesting a size when the frame is mapped is apparently a mortal sin. Whatever it be, I attach a patch to address this issue. It basically means that on a tiling WM you cannot start with an iconic frame (but doing so should not make sense anyway). If people still want to do that, we probably need a customizable variable where users tell Emacs what kind of WM they use. martin --------------018C670F25B02CF28A967367 Content-Type: text/x-patch; name="Tassilo.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Tassilo.diff" diff --git a/src/frame.h b/src/frame.h index 744b95e1e0..75a0b184c1 100644 =2D-- a/src/frame.h +++ b/src/frame.h @@ -456,7 +456,11 @@ #define EMACS_FRAME_H /* True when new_width or new_height were set by change_frame_size, false when they were set by adjust_frame_size internally or not set. */ - bool_bf new_size_p; + bool_bf new_size_p : 1; + + /* True when frame was invisible before first MapNotify event. Used + in X builds only. */ + bool_bf was_invisible : 1; /* Bitfield area ends here. */ diff --git a/src/nsfns.m b/src/nsfns.m index 1f281f75fd..d14f7b51ea 100644 =2D-- a/src/nsfns.m +++ b/src/nsfns.m @@ -1404,6 +1404,7 @@ Turn the input menu (an NSMenu) into a lisp list for= tracking on lisp side. else { /* Must have been Qnil. */ + f->was_invisible =3D true; } } diff --git a/src/w32fns.c b/src/w32fns.c index 66baeaecbd..e5edd62abb 100644 =2D-- a/src/w32fns.c +++ b/src/w32fns.c @@ -6107,6 +6107,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_= frame, if (!NILP (visibility)) w32_make_frame_visible (f); + else + f->was_invisible =3D true; } store_frame_param (f, Qvisibility, visibility); diff --git a/src/xfns.c b/src/xfns.c index 782e0a483c..82ad15c52c 100644 =2D-- a/src/xfns.c +++ b/src/xfns.c @@ -4140,6 +4140,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_= frame, if (!NILP (visibility)) x_make_frame_visible (f); + else + f->was_invisible =3D true; } store_frame_param (f, Qvisibility, visibility); diff --git a/src/xterm.c b/src/xterm.c index 9edaed9a34..a663a0f184 100644 =2D-- a/src/xterm.c +++ b/src/xterm.c @@ -8181,8 +8181,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, #if defined USE_GTK && defined HAVE_GTK3 /* If GTK3 wants to impose some old size here (Bug#24526), tell it that the current size is what we want. */ - xg_frame_set_char_size - (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + if (f->was_invisible) + { + xg_frame_set_char_size + (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + f->was_invisible =3D false; + } #endif XSETFRAME (inev.ie.frame_or_window, f); } @@ -8443,8 +8447,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, #if defined USE_GTK && defined HAVE_GTK3 /* If GTK3 wants to impose some old size here (Bug#24526), tell it that the current size is what we want. */ - xg_frame_set_char_size - (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + if (f->was_invisible) + { + xg_frame_set_char_size + (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + f->was_invisible =3D false; + } #endif f->output_data.x->has_been_visible =3D true; } --------------018C670F25B02CF28A967367--