Skip to content

Add xdg-decoration-v2 protocol

Julian Orth requested to merge mahkoh/wayland-protocols:jorth/deco2 into main

This protocol allows compositors and clients to announce their capabilities, preferences, and intents regarding decorations. Neither party is forced to draw or not draw decorations.

For example, GNOME would always announce that it does NOT support drawing SSD.

A tiling compositor would always announce that it does NOT support NOT drawing SSD while the toplevel is tiled. If the user switches a window from tiled to floating, the compositor might announce that it now supports NOT drawing SSD. If the client has announced that it can draw and prefers drawing CSD, the compositor might announce that it will stop drawing SSD after the next configure/ack sequence.

Some examples:

  1. A compositor that only supports drawing SSD:

    The compositor can essentially ignore the client's announced configuration. It will always send the following events:

    xdg_toplevel_ssd_configuration_v2.supports_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.prefers_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.draws_ssd
    xdg_toplevel_ssd_configuration_v2.commit
  2. A compositor that only supports NOT drawing SSD:

    The compositor can essentially ignore the client's announced configuration. It will always send the following events:

    xdg_toplevel_ssd_configuration_v2.supports_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.prefers_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.commit
  3. A client that only supports drawing CSD:

    The client can essentially ignore the compositors's announced configuration. It will always send the following requests:

    -> xdg_toplevel_csd_configuration_v2.supports_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.prefers_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.commit
  4. A client that only supports NOT drawing CSD:

    The client can essentially ignore the compositors's announced configuration. It will always send the following requests:

    -> xdg_toplevel_csd_configuration_v2.supports_not_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.prefers_not_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.commit
  5. A compositor that fully supports NOT drawing SSD and has a poor implementation of drawing SSD:

    The compositor would announce support for both modes and a preference for NOT drawing SSD. If a client announces support for darwing CSD, the compositor will never draw SSD even if the client prefers SSD:

    xdg_toplevel_ssd_configuration_v2.supports_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.supports_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.prefers_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.commit
    -> xdg_toplevel_csd_configuration_v2.supports_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.supports_not_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.prefers_not_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.commit
    xdg_toplevel_ssd_configuration_v2.supports_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.supports_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.prefers_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.commit ```
    
  6. A compositor that supports both drawing SSD and NOT drawing SSD:

    If it encounters a client that does NOT support drawing CSD, it should always draw SSD:

    -> xdg_toplevel_csd_configuration_v2.supports_not_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.prefers_not_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.commit
    xdg_toplevel_ssd_configuration_v2.supports_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.supports_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.draws_ssd
    xdg_toplevel_ssd_configuration_v2.commit

    If it encounters a client that does ONLY support drawing CSD, it should never draw SSD (unless overwritten by a user preference):

    -> xdg_toplevel_csd_configuration_v2.supports_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.prefers_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.commit
    xdg_toplevel_ssd_configuration_v2.supports_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.supports_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.commit

    If it encounters a client that supports both, then it might consider a configured user preference or might consider the preference announced by the client:

    xdg_toplevel_ssd_configuration_v2.supports_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.supports_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.prefers_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.draws_ssd
    xdg_toplevel_ssd_configuration_v2.commit
    -> xdg_toplevel_csd_configuration_v2.supports_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.supports_not_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.prefers_drawing_csd
    -> xdg_toplevel_csd_configuration_v2.commit
    xdg_toplevel_ssd_configuration_v2.supports_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.supports_not_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.prefers_drawing_ssd
    xdg_toplevel_ssd_configuration_v2.commit

    If the client does not care in such a situation, it need not announce its own configuration and can just follow the compositors preference.

Additionally, the protocol allows the client to receive a default configuration without having to first create a toplevel.

Signed-off-by: Julian Orth ju.orth@gmail.com

Merge request reports