unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Florian Rommel <mail@florommel.de>
Cc: emacs-devel@gnu.org
Subject: Re: Support fullscreen values fullheight and fullwidth on pgtk
Date: Thu, 02 Jun 2022 14:00:12 +0800	[thread overview]
Message-ID: <87r1477ggj.fsf@yahoo.com> (raw)
In-Reply-To: <b3b884ec3521d4b99535bd7a6c037bd287f42ade.camel@florommel.de> (Florian Rommel's message of "Wed, 01 Jun 2022 16:57:04 +0200")

Florian Rommel <mail@florommel.de> 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.



  reply	other threads:[~2022-06-02  6:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 14:57 Support fullscreen values fullheight and fullwidth on pgtk Florian Rommel
2022-06-02  6:00 ` Po Lu [this message]
2022-06-03  8:11   ` Florian Rommel
2022-06-03  8:23     ` Po Lu
2022-06-03 18:42       ` Florian Rommel
2022-06-04  1:17         ` Po Lu
2022-06-04 14:03           ` Florian Rommel
2022-06-05  1:06             ` Po Lu
2022-06-05  5:41               ` Eli Zaretskii
2022-06-05 10:41                 ` Florian Rommel
2022-07-03 11:08                   ` Florian Rommel
2022-07-03 11:37                     ` Po Lu
2022-07-03 11:39                       ` Florian Rommel
2022-07-04  2:20                         ` Po Lu
2022-07-07 18:52                           ` Florian Rommel
2022-07-08  2:30                             ` Po Lu
2022-07-08  5:49                               ` Eli Zaretskii
2022-07-08  6:34                                 ` Po Lu
2022-07-08  7:10                                   ` Eli Zaretskii
2022-07-08  7:37                                     ` Po Lu
2022-07-03 13:17                       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1477ggj.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=mail@florommel.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).