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

@ -402,6 +402,12 @@ struct wl_window {
bool is_tiled_left;
bool is_tiled_right;
bool is_tiled; /* At least one of is_tiled_{top,bottom,left,right} is true */
bool is_constrained_top;
bool is_constrained_bottom;
bool is_constrained_left;
bool is_constrained_right;
struct {
int width;
int height;
@ -409,10 +415,17 @@ struct wl_window {
bool is_fullscreen:1;
bool is_maximized:1;
bool is_resizing:1;
bool is_tiled_top:1;
bool is_tiled_bottom:1;
bool is_tiled_left:1;
bool is_tiled_right:1;
bool is_constrained_top:1;
bool is_constrained_bottom:1;
bool is_constrained_left:1;
bool is_constrained_right:1;
enum csd_mode csd_mode;
} configure;