From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Support fullscreen values fullheight and fullwidth on pgtk Date: Thu, 02 Jun 2022 14:00:12 +0800 Message-ID: <87r1477ggj.fsf@yahoo.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37922"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: emacs-devel@gnu.org To: Florian Rommel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 02 08:06:55 2022 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 1nwdyx-0009ad-EF for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Jun 2022 08:06:55 +0200 Original-Received: from localhost ([::1]:56402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwdyv-0006JT-T3 for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Jun 2022 02:06:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwdsk-00047N-GN for emacs-devel@gnu.org; Thu, 02 Jun 2022 02:00:30 -0400 Original-Received: from sonic305-20.consmr.mail.ne1.yahoo.com ([66.163.185.146]:38763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwdsh-0001N0-SN for emacs-devel@gnu.org; Thu, 02 Jun 2022 02:00:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1654149625; bh=rj60slSxKUhsr/7+XNaRbARRtCHoGLome+P0Xl+FYsw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=A0nClA5OSm/PwiPwFEYe03ihgIwC6SboApwCdF5bO7AN7JMY93cquQFtfd7vAzt/S8A4kNR9qozxrYEryugr93nsVWLXhagu1YmKsv+AXWvYlrCFTceZmtqwTQ4cHFdHK8ZkH0Tq3PTjAKuPMA3aXaENVdkVdkxQDv//vSNWyF3ETrMtJKoX+r9ZtxX2HP1by99/zlXGuAecyPGFeCh3qD2JM1/rJ9XJ0IkOukcfbGSXFJYwa+X8gM3uQsxr9N8XtzaeaYKRcJKIzYphMLSHzYbe7h/By5XsLbvk+mIIt+6D4vXVc9lrEGwXwOS0NJcWts84DDUXaomnQH6O9jMHbw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1654149625; bh=uWFFsZlxKZdk/qmyNr/0X+wBkVrqvlsqyERqBsBSC2+=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Ap8GNNA50B5gjRzvWUMlhyZJ+7S14RhETgYVCSyTtiVPCOOPMFlfeVfD/seEGO5XVvoNESps+5SpNPrvqroI5sX9sh7LcvcdAfo66er9cBdflIN/Qtgjsu2ZG88Mmri7BRGZvBnZ1wDElIUfe3zasFU7U+Cvx8lyQfd79cSKrreHWAFDsZmtDxnES0ZXfU1XpA4KWmg3pEK3vL49PQtrjLWBoPuV8kkFMypKjjKVH5qfU599wSzEZztozH/boNwj365kQhtVAIb5D9VE9nCrT64Jn+qwrBBxBnJPyaS3uOqd7fGsSdnk++DgF3iGRBhgdCRZoALOK8SjySYCkgBWEg== X-YMail-OSG: iERAIBoVM1m7RBxH4FKrwTjqMVTq7.FzUL7v6CiWHqf0RcW9mpE4fyxXDuYMouo MaaPg6W6WLea7vCRVb4BOUOzJkseughiAamry7tVvh.umftHeRWbq5_C.mp4hIW0gY8_peqUQmcF s670hvbD4LCW2qzMQXwi52AcJ6m.xSnaB6xeaRbNaJTxRyJRBsVCiFmsLotJjyRGy4h4y51TH0MN 993yuMwXLPooO9o3M5n.kaCoHeMAJ4IoVyUSrMA79eIff.K9U8Ml_cTlX9Rqg.5CwNpBTZBkGNEr Q5nMFAysHGW9F4XVRVIPNKHtYY0tIEAaDuStbwt7R6Ewnl74m4oye_u1rUSC3u06GAI.KleH.E59 HHyDH4he64SygTHrm8QyXF6wDQxhoS9FcDNW63WLWpOU4lqJ444q93kaiRI4yFcHOnToXcSKrnLU acCpvP3uco21M7MW_0hmtQZFOsWCFPLmNP0cO6vYi51V0J4KmPBJkHv_y4A2M65HDcQQZ3QA1caD L.8GMDZH6ZwrRRD6s6gYZ7dAylOjHMm5zQ6zHXL17sjJKkqjvJB5gF5.tgETIBiwH7vvWRR0GEhw cD8PI38Y1vtISq8anBKi4eOkOwp5rcyLkHHBTeSQ5k.x1T43WiW6q9.cNXJt9ANluNhLAZviXFUN Yeu2HcRYiJYBAlG746oRA1qIwPozershMQ3W6Ac9voDw9KgcWV0RHk9rcnxfzHjyocbEvrroUAD8 YXhlwa8qabZKnZZZRYx3UbwgW6C_jQ8y6cZL6BRp25V8J_kYj0tL4Cl6eX1OV_rAjpkF8gOQUGbG WmKeIrCSDRxz5dOqV1eyOOaUNSg4AhDcZlNM8FfKaT X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Thu, 2 Jun 2022 06:00:25 +0000 Original-Received: by hermes--canary-production-sg3-5f7658c994-rpd7c (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 3a7cd77bc7f043366ae63f3dfe92e818; Thu, 02 Jun 2022 06:00:18 +0000 (UTC) In-Reply-To: (Florian Rommel's message of "Wed, 01 Jun 2022 16:57:04 +0200") X-Mailer: WebService/1.1.20225 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.146; envelope-from=luangruo@yahoo.com; helo=sonic305-20.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:290541 Archived-At: Florian Rommel writes: > This is a suggestion to support the values 'fullheight and 'fullwidth > for the fullscreen frame parameter on pgtk. > Background: I undecorate the frame when it is maximized or "tiled" (in > Gnome) to the left or right (-> fullheight, currently not supported on > pgtk - only with the X backend). > > The patch uses the GDK_WINDOW_STATE_*_TILED and > GDK_WINDOW_STATE_*_RESIZABLE flags that are available since GTK > 3.22.23. A value of 'fullheight is set if the top and the bottom edges > are marked as tiled and not resizable; 'fullwidth is set if the left > and right edges are marked as tiled and not resizable. > So, is the introduced behavior correct? I think it is consistent with > the description in the Emacs manual: "a fullwidth frame is as wide as > possible, a fullheight frame is as tall as possible". It seems reasonable enough to me, though GTK sets those state flags in situations in some situations that don't exactly correspond to _NET_WM_STATE_MAXIMIZED_HORZ and _NET_WM_STATE_MAXIMIZED_VERT, which are used by the X build. > On Gnome, it works as expected. Other desktop environments, such as > KDE, Xfce or tiling window managers don't seem to support the > GTK_WINDOW_STATE_*_{TILED/RESIZABLE} flags, so fullheight and fullwidth > will still never be set there (however, this also seems to be the case > with the Emacs X backend). > > Regards, > Flo Thanks, some comments below. > + GdkWindowState new_state = event->window_state.new_window_state; > union buffered_input_event inev; IMO it would look better to simply write: GdkWindowState new_state; and then place new_state = event->window_state.new_window_state; after all the variable declarations. > +#if GTK_CHECK_VERSION (3, 22, 23) > + else if ((new_state & GDK_WINDOW_STATE_TOP_TILED) && > + (new_state & GDK_WINDOW_STATE_BOTTOM_TILED) && > + !(new_state & GDK_WINDOW_STATE_TOP_RESIZABLE) && > + !(new_state & GDK_WINDOW_STATE_BOTTOM_RESIZABLE)) > + store_frame_param (f, Qfullscreen, Qfullheight); > + else if ((new_state & GDK_WINDOW_STATE_LEFT_TILED) && > + (new_state & GDK_WINDOW_STATE_RIGHT_TILED) && > + !(new_state & GDK_WINDOW_STATE_LEFT_RESIZABLE) && > + !(new_state & GDK_WINDOW_STATE_RIGHT_RESIZABLE)) > + store_frame_param (f, Qfullscreen, Qfullwidth); > +#endif I think we should just bump the version of GTK required for PGTK to 3.22, since users of older versions can use the regular X build. Our coding style is also to place the "&&" on the next line. Here and in other places, write: if (very_long_condition_here && other_very_long_condition_here) do_something (); instead of: if (very_long_condition_here && other_very_long_condition_here) do_something (); You also forgot to implement setting the `fullwidth' and `fullheight' states. It should be easy to implement in `set_fullscreen_state', though I admit I haven't looked very closely at that.