From b4ed09e2957e92e1cb5c037df7de41f2d22de3aa Mon Sep 17 00:00:00 2001 From: Dallas Strouse Date: Wed, 30 Apr 2025 15:21:21 +0000 Subject: [PATCH] staging: xdg-decoration-v1 This protocol brings the unstable xdg-decoration-v1 into the modern age, and allows compositors such as Mutter, and toolkits like GTK, to support (at least a subset of) server-side decorations. Compositors are not forced to advertise support for the full range of capabilities in this protocol, and for the capabilities they do expose, clients get full control over what gets drawn on their windows. Co-authored-by: Neal Gompa --- staging/xdg-decoration/README | 5 + staging/xdg-decoration/xdg-decoration-v1.xml | 192 +++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 staging/xdg-decoration/README create mode 100644 staging/xdg-decoration/xdg-decoration-v1.xml diff --git a/staging/xdg-decoration/README b/staging/xdg-decoration/README new file mode 100644 index 0000000..fec54af --- /dev/null +++ b/staging/xdg-decoration/README @@ -0,0 +1,5 @@ +xdg_decoration protocol + +Maintainers: +Dallas Strouse (@orowith2os) +Neal Gompa (@Conan_Kudo) \ No newline at end of file diff --git a/staging/xdg-decoration/xdg-decoration-v1.xml b/staging/xdg-decoration/xdg-decoration-v1.xml new file mode 100644 index 0000000..b5fd5b9 --- /dev/null +++ b/staging/xdg-decoration/xdg-decoration-v1.xml @@ -0,0 +1,192 @@ + + + + Copyright © 2018 Simon Ser + Copyright © 2025 Dallas Strouse + Copyright © 2025 Neal Gompa + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + This interface allows a compositor to announce support for one or more + types of decorations. + + Window decorations are a set of window controls as deemed appropriate by + the party managing them, such as user interface components used to move, + resize and change a toplevel surface's state, drop shadows, and other visual styling + around a toplevel. + + A client can use this protocol to request being decorated by a supporting + compositor. + + If compositor and client do not negotiate the use of any type of + decoration using this protocol, clients continue to self-decorate as they + see fit. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + Destroy the decoration manager. This doesn't destroy objects created + with the manager. + + + + + + Create a new decoration object associated with the given toplevel. + + Creating an xdg_toplevel_decoration from an xdg_toplevel which has a + buffer attached is a client error. + + + + + + + + + The decoration object allows the compositor to toggle server-side toplevel + decorations for a toplevel surface. The client can request to switch to + another mode. + + The xdg_toplevel_decoration object must be destroyed before its xdg_toplevel. + + + + + + + + + + + + These values describe toplevel decoration modes. + + + + + + + + + Destroys this object, and switches back to a mode without any server-side + decorations at the next commit. The client will draw decorations as it sees fit. + + The xdg_toplevel_decoration object must be destroyed before its xdg_toplevel. + + + + + + + The meaning of this value is defined by the event/request it is associated with. + + It is only valid to send this value in a set_decorations request with a "server" + event type if the misc_decorations value was present in the associated + decoration_capabilities event, and doing so without that value being present will + raise an invalid_mode protocol error. This value will never exist on a + decoration_capabilities event type of "server". + + If sent in a decoration_capabilities event with the "client" decoration drawer type, + the compositor has no preferences on how clients should draw their toplevels + if not using server-drawn decorations. + + + + + The compositor will draw, or would prefer that the client draws, drop + shadows around the geometry specified in xdg-surface::set_window_geometry + and supporting protocols. + + + + + This represents what would traditionally be considered toplevel controls, + such as the titlebar and close button, but is not guaranteed to be so, if + it does not fit with a compositor's capabilities. The compositor is free to + draw any decorations as it sees fit with this value. + + A compositor may pair this with any other values in a decoration_capabilities + "server" request if it supports drawing this type of decoration, but it + is a protocol error, and will raise invalid_mode, to set this value instead + of a zero value in a set_decorations "server" request. + + + + + + + This event will be always be sent once with the "client" supported_decoration_drawer argument, + and will be accompanied by a second decoration_capabilities event with a "server" supported_decoration_drawer + argument, if supported by the compositor. + + If this event is ever sent without an accompanying "server" event type, including after object creation, + the client must not request server-drawn decorations, nor commit any new state using server-drawn decorations, + otherwise it will raise the invalid_mode error. + + See the set_decorations request for how to signal which decoration mode the client would + like, and which decorations the client would like to have drawn for it. + + This event may be sent several times over the lifetime of xdg_toplevel_decoration object, + each time (including the initial event) with an xdg_surface::configure event; + clients must re-configure themselves with the new described modes before committing their state, + otherwise an invalid_mode error is raised by the compositor. + + + + + + + + Set the toplevel surface decoration mode. This informs the compositor that + the client would like to be drawn in the provided decoration mode, and if + specified, which decorations should be drawn by the compositor. + + If the decoration_drawer argument is "client", the capabilities argument is + used to hint to the compositor which decorations are drawn by the client. + + If the decoration_drawer argument is "server", the capabilities argument + must only contain valid arguments (sent in a previous decoration_capabilities event) + or zero, and the compositor will draw those decorations on behalf of the client. + + Clients whose decoration mode depend on the xdg_toplevel state may send + a set_decorations request in response to an xdg_surface.configure event and wait + for the next xdg_surface.configure event to prevent unwanted state. + Such clients are responsible for preventing configure loops and must + make sure not to send multiple successive set_decorations requests with the + same decoration mode. + + If an invalid or unknown mode is supplied by the client, the + invalid_mode protocol error is raised by the compositor. + + + + + + +