wayland+input: add support for toplevel edge constraints

Edge constraints are new (not yet available in a wayland-protocols
release) toplevel states, acting as a complement to the existing tiled
states.

Tiled tells us we shouldn't draw shadows etc *outside our window
geometry*.

Constrained tells us the window cannot be resized in the constrained
direction.

This patch does a couple of things:

* Recognize the new states when debug logging

* Change is_top_left() etc to look at the new constrained state
  instead of the tiled state. These functions are used when both
  choosing cursor shape, and when determining if/how to resize a
  window on a CSD edge click-and-drag.

* Update cursor shape selection to use the default (left_ptr) shape
  when on a constrained edge (or corner).

* Update CSD resize triggering, to not trigger a resize when attempted
  on a constrained edge (or corner).

See
86750c99ed:

    An edge constraint is an complementery state to the tiled state,
    meaning that it's not only tiled, but constrained in a way that it
    can't resize in that direction.

    This typically means that the constrained edge is tiled against a
    monitor edge. An example configuration is two windows tiled next
    to each other on a single monitor. Together they cover the whole
    work area.

    The left window would have the following tiled and edge constraint
    state:

        [ tiled_top, tiled_right, tiled_bottom, tiled_left,
          constrained_top, constrained_bottom, constrained_left ]

    while the right window would have the following:

        [ tiled_top, tiled_right, tiled_bottom, tiled_left,
          constrained_top, constrained_bottom, constrained_right ]

    This aims to replace and deprecate the
    `gtk_surface1.configure_edges` event and the
    `gtk_surface1.edge_constraint` enum.
This commit is contained in:
Daniel Eklöf 2025-04-07 13:32:30 +02:00
parent 091aa90f1a
commit 23431e3ecf
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 114 additions and 30 deletions

View file

@ -61,6 +61,12 @@
## Unreleased
### Added
* Support for toplevel edge constraints. When the compositor indicates
the toplevel has edge constraints, foot will not allow the window to
be resized (via CSDs) in the constrained directions.
### Changed
* UTF-8 error recovery now discards fewer bytes.
@ -83,6 +89,8 @@
([#2016][2016]). You can manually set the [old
one](https://codeberg.org/dnkl/foot/src/tag/1.21.0/foot.ini#L72), if
you prefer it over the new regex.
* A tiled window can now be resized in the corners (via CSDs), unless
the compositor has indicated the toplevel has edge constraints.
[2006]: https://codeberg.org/dnkl/foot/issues/2006
[2009]: https://codeberg.org/dnkl/foot/issues/2009