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: Tue, 11 May 2021 10:29:45 +0200 Message-ID: References: <69a5e928-2998-f776-fa0d-f35e6ab1e65d@gmx.at> <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> <726883d4-8d13-a3cb-30b7-a74c4b44f8ed@gmx.at> <87a6p3iv9q.fsf@gnu.org> <48753133-11a3-a21f-a1f9-4e58508079ac@gmx.at> <36f3b7b6-b81c-2e89-99c8-0a8837ef7869@gmx.at> <874kfabe7j.fsf@gnu.org> <1de34884-dfa3-92ba-8c6d-d256dcbb5d2b@gmx.at> <871raebctt.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------0589924A5E705E708FEFEBA7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4131"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Garjola Dindi , emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 11 11:07:17 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 1lgOMH-0000ue-3K for ged-emacs-devel@m.gmane-mx.org; Tue, 11 May 2021 11:07:17 +0200 Original-Received: from localhost ([::1]:46672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgOMG-0002Ib-39 for ged-emacs-devel@m.gmane-mx.org; Tue, 11 May 2021 05:07:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgNm7-0002dt-Bv for emacs-devel@gnu.org; Tue, 11 May 2021 04:29:55 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:37565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgNm4-0001hb-NW; Tue, 11 May 2021 04:29:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620721787; bh=Hai97nAA0cZJvMxJtZNLUJ8vi+4bsMJtYOP1QIYscUk=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=T2sdZ7Sk3anFhQgnRTlH8j3yxNM7/YZKOo76XrSdCywav/hzmBkl3Z9gATRrPF2Pf mz5eJGZQPDmBSf/knX30WB8oS+4gEVgEuuJB0ZKsYrI/5PvEchJ1H5L74jBHyUORLy cZ2IQrTHUd08hdFCO9Yc/RBLtUAzOQhIcLuH7ADE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([46.125.249.112]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M9nxn-1ldNd822L7-005qyU; Tue, 11 May 2021 10:29:47 +0200 In-Reply-To: <871raebctt.fsf@gnu.org> Content-Language: en-US X-Provags-ID: V03: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jXMD8B4ypCleq6T1gOnuPu/F Received-SPF: pass client-ip=212.227.15.15; envelope-from=rudalics@gmx.at; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:269149 Archived-At: This is a multi-part message in MIME format. --------------0589924A5E705E708FEFEBA7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit >> OK. Now please start with emacs -Q -iconic and tell me how it looks >> like when you deiconify it. > > Iconified frames/windows are nothing supported by sway. If you don't > need a window but don't want to close it, you can send it to the > scratchpad workspace. If there were an API for that we could support it. I still don't get a couple of things with sway: Does it support resize requests? What happens when you make an already visible frame invisible or iconified? Does it support size hints? > Anyway, emacs -Q -iconic results in a frame where > only the menubar is shown and the toolbar is missing until I switch > focus back and forth, so just like a normal, non-iconic frame without > your latest patch. > >> Also please do a >> >> (setq frame (make-frame '((visibility . icon)))) > > I get a new frame with a menubar but no toolbar (unless I'd resize it or > swith focus back and forth). While here we could say "don't do that, then" ... >> followed by (make-frame-visible frame) > > No observable change. > >> and a >> >> (setq frame (make-frame '((visibility . nil)))) > > Nothing happens which I guess is expected. ... this one looks like valid behavior ... >> (make-frame-visible frame) > > The frame appears with again a menubar but no toolbar (until I apply one > of my workarounds as above). ... and this is our usual annoyance. I attached a new patch which should handle these cases as well. If there's anything else left, please tell me. martin --------------0589924A5E705E708FEFEBA7 Content-Type: text/x-patch; name="frame-was-visible.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="frame-was-visible.diff" diff --git a/lisp/faces.el b/lisp/faces.el index 68bfbbae38..9969140f0c 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2118,7 +2118,23 @@ x-create-frame-with-faces (x-handle-reverse-video frame parameters) (frame-set-background-mode frame t) (face-set-after-frame-default frame parameters) - (if (null visibility-spec) + ;; Mark frame as 'was-invisible' when it was created as + ;; invisible or iconified and PARAMETERS contains either a + ;; width or height specification. This should be sufficient + ;; to handle Bug#24526 (where a frame is initially iconified + ;; to allow manipulating its size in a non-obtrusive way) and + ;; avoid that a tiling window manager for GTK3 gets a resize + ;; request it cannot handle (Bug#48268). The 'was-invisible' + ;; flag is eventually processed in xterm.c after we receive a + ;; MapNotify event; non-X builds ignore it. + (frame--set-was-invisible + frame + (and visibility-spec + (memq (cdr visibility-spec) '(nil icon)) + (or (assq 'width parameters) + (assq 'height parameters)))) + + (if (null visibility-spec) (make-frame-visible frame) (modify-frame-parameters frame (list visibility-spec))) (setq success t)) diff --git a/src/frame.c b/src/frame.c index 738bfe9a5c..15988a6c30 100644 --- a/src/frame.c +++ b/src/frame.c @@ -971,6 +971,7 @@ make_frame (bool mini_p) f->no_accept_focus =3D false; f->z_group =3D z_group_none; f->tooltip =3D false; + f->was_invisible =3D false; f->child_frame_border_width =3D -1; f->last_tab_bar_item =3D -1; #ifndef HAVE_EXT_TOOL_BAR @@ -5907,7 +5908,18 @@ DEFUN ("frame-pointer-visible-p", Fframe_pointer_v= isible_p, return decode_any_frame (frame)->pointer_invisible ? Qnil : Qt; } =20 +DEFUN ("frame--set-was-invisible", Fframe__set_was_invisible, + Sframe__set_was_invisible, 2, 2, 0, + doc: /* Set FRAME's was-invisible flag if WAS-INVISIBLE is non-ni= l. +This function is for internal use only. */) + (Lisp_Object frame, Lisp_Object was_invisible) +{ + struct frame *f =3D decode_live_frame (frame); =20 + f->was_invisible =3D !NILP (was_invisible); + + return f->was_invisible ? Qt : Qnil; +} =0C /***********************************************************************= Multimonitor data @@ -6547,6 +6559,7 @@ focus (where a frame immediately loses focus when i= t's left by the mouse defsubr (&Sframe_position); defsubr (&Sset_frame_position); defsubr (&Sframe_pointer_visible_p); + defsubr (&Sframe__set_was_invisible); defsubr (&Sframe_window_state_change); defsubr (&Sset_frame_window_state_change); defsubr (&Sframe_scale_factor); diff --git a/src/frame.h b/src/frame.h index 744b95e1e0..75a0b184c1 100644 --- 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; =20 /* Bitfield area ends here. */ =20 diff --git a/src/nsfns.m b/src/nsfns.m index 1f281f75fd..d14f7b51ea 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1404,6 +1404,7 @@ Turn the input menu (an NSMenu) into a lisp list fo= r tracking on lisp side. else { /* Must have been Qnil. */ + f->was_invisible =3D true; } } =20 diff --git a/src/w32fns.c b/src/w32fns.c index 66baeaecbd..e5edd62abb 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6107,6 +6107,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create= _frame, =20 if (!NILP (visibility)) w32_make_frame_visible (f); + else + f->was_invisible =3D true; } =20 store_frame_param (f, Qvisibility, visibility); diff --git a/src/xfns.c b/src/xfns.c index 782e0a483c..e46616e6d6 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4127,12 +4127,21 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_crea= te_frame, cannot control visibility, so don't try. */ if (!f->output_data.x->explicit_parent) { + /* When called from `x-create-frame-with-faces' visibility is + always explicitly nil. */ Lisp_Object visibility =3D gui_display_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL); + Lisp_Object height + =3D gui_display_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER= ); + Lisp_Object width + =3D gui_display_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER)= ; =20 if (EQ (visibility, Qicon)) - x_iconify_frame (f); + { + f->was_invisible =3D true; + x_iconify_frame (f); + } else { if (EQ (visibility, Qunbound)) @@ -4140,8 +4149,17 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_creat= e_frame, =20 if (!NILP (visibility)) x_make_frame_visible (f); + else + f->was_invisible =3D true; } =20 + /* Leave f->was_invisible true only if height or width were + specified too. This takes effect only when we are not called + from `x-create-frame-with-faces' (see above comment). */ + f->was_invisible + =3D (f->was_invisible + && (!EQ (height, Qunbound) || !EQ (width, Qunbound))); + store_frame_param (f, Qvisibility, visibility); } =20 diff --git a/src/xterm.c b/src/xterm.c index 9edaed9a34..a663a0f184 100644 --- 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; } --------------0589924A5E705E708FEFEBA7--