emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Support fullscreen values fullheight and fullwidth on pgtk


From: Po Lu
Subject: Re: Support fullscreen values fullheight and fullwidth on pgtk
Date: Thu, 02 Jun 2022 14:00:12 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]