wayland::subsurface_t(3)
๐ wayland::subsurface_t(3) ๐
okay bestie, welcome to the Wayland++ manual page for wayland::subsurface_t โ literally the sub-surface interface to a wl_surface. This is part 1, and itโs giving protocol-bestie energy. ๐ฆโจ
๐ NAME ๐
wayland::subsurface_t โ sub-surface interface to a wl_surface
โจ SYNOPSIS โจ
#include <wayland-client-protocol.hpp>
Inherits wayland::proxy_t.
๐ฆ Public Types
enum class wrapper_type { standard, display, foreign, proxy_wrapper }
๐ Public Member Functions
void set_position (int32_t x, int32_t y)โ reposition the sub-surface.void place_above (surface_t const &sibling)โ restack the sub-surface.void place_below (surface_t const &sibling)โ restack the sub-surface.void set_sync ()โ set sub-surface to synchronized mode.void set_desync ()โ set sub-surface to desynchronized mode.uint32_t get_id () constโ grab the id of a proxy object.std::string get_class () constโ grab the interface name (class) of a proxy object.uint32_t get_version () constโ grab the protocol object version of a proxy object.wrapper_type get_wrapper_type () constโ grab the type of a proxy object.void set_queue (event_queue_t queue)โ assign a proxy to an event queue.wl_proxy * c_ptr () constโ grab a pointer to the underlying C struct.bool proxy_has_object () constโ check whether this wrapper actually wraps an object.operator bool () constโ check whether this wrapper actually wraps an object.bool operator== (const proxy_t &right) constโ check whether two wrappers refer to the same object.bool operator!= (const proxy_t &right) constโ check whether two wrappers refer to different objects.void proxy_release ()โ release the wrapped object (if any), making this an empty wrapper.
๐ Static Public Attributes
static constexpr std::uint32_t set_position_since_version = 1โ minimum protocol version required for theset_positionfunction.static constexpr std::uint32_t place_above_since_version = 1โ minimum protocol version required for theplace_abovefunction.static constexpr std::uint32_t place_below_since_version = 1โ minimum protocol version required for theplace_belowfunction.static constexpr std::uint32_t set_sync_since_version = 1โ minimum protocol version required for theset_syncfunction.static constexpr std::uint32_t set_desync_since_version = 1โ minimum protocol version required for theset_desyncfunction.
๐ Detailed Description ๐
sub-surface interface to a wl_surface
So this is an extra interface to a wl_surface object that has been made a sub-surface. A sub-surface has one parent surface. A sub-surfaceโs size and position are not limited to that of the parent. Particularly, a sub-surface is not automatically clipped to its parentโs area. no cap. ๐ซถ
A sub-surface becomes mapped when a non-NULL wl_buffer is applied and the parent surface is mapped. The order of which one happens first is irrelevant. A sub-surface is hidden if the parent becomes hidden, or if a NULL wl_buffer is applied. These rules apply recursively through the tree of surfaces. ๐ณโจ
The behaviour of a wl_surface.commit request on a sub-surface depends on the sub-surfaceโs mode. The possible modes are synchronized and desynchronized, see methods wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized mode caches the wl_surface state to be applied when the parentโs state gets applied, and desynchronized mode applies the pending wl_surface state directly. A sub-surface is initially in the synchronized mode. periodt. ๐
Sub-surfaces also have another kind of state, which is managed by wl_subsurface requests, as opposed to wl_surface requests. This state includes the sub-surface position relative to the parent surface (wl_subsurface.set_position), and the stacking order of the parent and its sub-surfaces (wl_subsurface.place_above and .place_below). This state is applied when the parent surfaceโs wl_surface state is applied, regardless of the sub-surfaceโs mode. As the exception, set_sync and set_desync are effective immediately. โก
The main surface can be thought to be always in desynchronized mode, since it does not have a parent in the sub-surfaces sense. ๐
Even if a sub-surface is in desynchronized mode, it will behave as in synchronized mode if its parent surface behaves as in synchronized mode. This rule is applied recursively throughout the tree of surfaces. This means that one can set a sub-surface into synchronized mode, and then assume that all its child and grand-child sub-surfaces are synchronized, too, without explicitly setting them. ๐งโโ๏ธโจ
If the wl_surface associated with the wl_subsurface is destroyed, the wl_subsurface object becomes inert. Note that destroying either object takes effect immediately. If you need to synchronize the removal of a sub-surface to the parent surface update, unmap the sub-surface first by attaching a NULL wl_buffer, update parent, and then destroy the sub-surface. โ ๏ธ
If the parent wl_surface object is destroyed, the sub-surface is unmapped.
Definition at line 3979 of file wayland-client-protocol.hpp.
๐ Member Enumeration Documentation ๐
enum class wayland::proxy_t::wrapper_type [strong], [inherited]
Underlying wl_proxy type and properties of a proxy_t that affect construction, destruction, and event handling.
Enumerator
standardโ C pointer is a standard type compatible withwl_proxy*. Events are dispatched and it is destructed when theproxy_tis destructed. User data is set.displayโ C pointer is awl_display*. No events are dispatched,wl_display_disconnectis called when theproxy_tis destructed. User data is set.foreignโ C pointer is a standard type compatible withwl_proxy*, but another library owns it and it should not be touched in a way that could affect the operation of the other library. No events are dispatched,wl_proxy_destroyis not called when theproxy_tis destructed, user data is not touched. Consequently, there is no reference counting for theproxy_t. Lifetime of such wrappers should preferably be short to minimize the chance that the owning library decides to destroy thewl_proxy.proxy_wrapperโ C pointer is awl_proxy*that was constructed withwl_proxy_create_wrapper. No events are dispatched,wl_proxy_wrapper_destroyis called when theproxy_tis destroyed. Reference counting is active. A reference to theproxy_tcreating this proxy wrapper is held to extend its lifetime until after the proxy wrapper is destroyed.
Definition at line 117 of file wayland-client.hpp.
๐ MEMBER FUNCTION DOCUMENTATION ๐
Every inherited proxy_t function is still in the mix here, no cap. ๐ซถ
wl_proxy * wayland::proxy_t::c_ptr () const [inherited]
This is your direct line to the underlying C struct, fr fr. It hands you a pointer to the actual wl_proxy underneath. ๐
Returns
- The underlying
wl_proxywrapped by thisproxy_tif it exists, otherwise an exception is thrown
std::string wayland::proxy_t::get_class () const [inherited]
Grab the interface name (class) of a proxy object. It's basically the label on the tin. ๐ท๏ธ
Returns
- The interface name of the object associated with the proxy
uint32_t wayland::proxy_t::get_id () const [inherited]
Get the id of a proxy object โ its little numeric name tag. ๐ข
Returns
- The id that belongs to the object associated with the proxy
uint32_t wayland::proxy_t::get_version () const [inherited]
Get the protocol object version of a proxy object. This returns the protocol object version of a proxy object, or 0 if the proxy was created with the unversioned API. ๐งพ
If you get 0 back, that means no version information is available, so the caller has to make safe assumptions about the object's real version. No cap. Also: display_t will always return version 0.
Returns
- The protocol object version of the proxy, or
0
wrapper_type wayland::proxy_t::get_wrapper_type () const [inline], [inherited]
Get the type of a proxy object. That's the wrapper_type vibe check. ๐ง
Definition at line 303 of file wayland-client.hpp.
wayland::proxy_t::operator bool () const [inherited]
Check whether this wrapper actually wraps an object. Basically: is there a real object under this wrapper, or is the wrapper empty? ๐
Returns
trueif there is an underlying object,falseif this wrapper is empty
bool wayland::proxy_t::operator!= (const proxy_t & right) const [inherited]
Check whether two wrappers refer to different objects. If they point at different stuff, this is your true. ๐
bool wayland::proxy_t::operator== (const proxy_t & right) const [inherited]
Check whether two wrappers refer to the same object. Same object? true. Iconic.
void subsurface_t::place_above (surface_t const & sibling)
restack the sub-surface โ this is the z-order glow-up. โจ
Parameters
siblingโ the reference surface
This sub-surface is taken from the stack, and put back just above the reference surface, changing the z-order of the sub-surfaces. The reference surface must be one of the sibling surfaces, or the parent surface.
Using any other surface, including this sub-surface, will cause a protocol error. ๐จ Like, do not do that.
The z-order is double-buffered. Requests are handled in order and applied immediately to a pending state. The final pending state is copied to the active state the next time the state of the parent surface is applied. When this happens depends on whether the parent surface is in synchronized mode or not. See wl_subsurface.set_sync and wl_subsurface.set_desync for details.
A new sub-surface is initially added as the top-most in the stack of its siblings and parent. ๐
Definition at line 3633 of file wayland-client-protocol.cpp.
void subsurface_t::place_below (surface_t const & sibling)
restack the sub-surface โ same restack energy, but downward. ๐ซก
Parameters
siblingโ the reference surface
The sub-surface is placed just below the reference surface. See wl_subsurface.place_above. That's the whole tea. ๐ต
Definition at line 3639 of file wayland-client-protocol.cpp.
bool wayland::proxy_t::proxy_has_object () const [inherited]
Check whether this wrapper actually wraps an object. Same energy as operator bool: real object or empty wrapper? ๐ฆ
Returns
trueif there is an underlying object,falseif this wrapper is empty
void wayland::proxy_t::proxy_release () [inherited]
Release the wrapped object (if any), making this an empty wrapper. Note that display_t instances cannot be released this way. Attempts to do so are ignored. ๐
Examples
foreign_display.cpp.
void subsurface_t::set_desync ()
set sub-surface to desynchronized mode โ change the commit behaviour of the sub-surface to desynchronized mode, also described as independent or freely running mode. It's giving main character energy: this surface updates on its own. ๐
In desynchronized mode, wl_surface.commit on a sub-surface will apply the pending state directly, without caching, as happens normally with a wl_surface. Calling wl_surface.commit on the parent surface has no effect on the sub-surface's wl_surface state. This mode allows a sub-surface to be updated on its own.
If cached state exists when wl_surface.commit is called in desynchronized mode, the pending state is added to the cached state, and applied as a whole. This invalidates the cache.
Note: even if a sub-surface is set to desynchronized, a parent sub-surface may override it to behave as synchronized. For details, see wl_subsurface.
If a surface's parent surface behaves as desynchronized, then the cached state is applied on set_desync.
Definition at line 3651 of file wayland-client-protocol.cpp.
void subsurface_t::set_position (int32_t x, int32_t y)
reposition the sub-surface โ move it to a new spot in the parent's coordinate system. ๐
Parameters
xโ x coordinate in the parent surfaceyโ y coordinate in the parent surface
This schedules a sub-surface position change. The sub-surface will be moved so that its origin (top left corner pixel) will be at the location x, y of the parent surface coordinate system. The coordinates are not restricted to the parent surface area. Negative values are allowed. Yes, negative. Go off. ๐
The scheduled coordinates will take effect whenever the state of the parent surface is applied. When this happens depends on whether the parent surface is in synchronized mode or not. See wl_subsurface.set_sync and wl_subsurface.set_desync for details.
If more than one set_position request is invoked by the client before the commit of the parent surface, the position of a new request always replaces the scheduled position from any previous request. Last one wins, bestie. ๐
The initial position is 0, 0.
Definition at line 3627 of file wayland-client-protocol.cpp.
void wayland::proxy_t::set_queue (event_queue_t queue) [inherited]
Assign a proxy to an event queue. This is how you tell events where to go. ๐๏ธ
Parameters
queueโ The event queue that will handle this proxy
Assign proxy to event queue. Events coming from proxy will be queued in queue instead of the display's main queue.
See also: display_t::dispatch_queue().
Examples
proxy_wrapper.cpp.
void subsurface_t::set_sync ()
set sub-surface to synchronized mode โ change the commit behaviour of the sub-surface to synchronized mode, also described as the parent dependent mode. It's attached-to-parent energy. ๐งท
In synchronized mode, wl_surface.commit on a sub-surface will accumulate the committed state in a cache, but the state will not be applied and hence will not change the compositor output. The cached state is applied to the sub-surface immediately after the parent surface's state is applied. This ensures atomic updates of the parent and all its synchronized sub-surfaces. Applying the cached state will invalidate the cache, so further parent surface commits do not (re-)apply old state.
See wl_subsurface for the recursive effect of this mode.
Definition at line 3645 of file wayland-client-protocol.cpp.
๐ MEMBER DATA DOCUMENTATION ๐
std::uint32_t wayland::subsurface_t::place_above_since_version = 1 [static], [constexpr]
Minimum protocol version required for the place_above function. ๐งฎ
Definition at line 4053 of file wayland-client-protocol.hpp.
std::uint32_t wayland::subsurface_t::place_below_since_version = 1 [static], [constexpr]
Minimum protocol version required for the place_below function. ๐งฎ
Definition at line 4066 of file wayland-client-protocol.hpp.
std::uint32_t wayland::subsurface_t::set_desync_since_version = 1 [static], [constexpr]
Minimum protocol version required for the set_desync function. ๐งฎ
Definition at line 4118 of file wayland-client-protocol.hpp.
std::uint32_t wayland::subsurface_t::set_position_since_version = 1 [static], [constexpr]
Minimum protocol version required for the set_position function. ๐งฎ
Definition at line 4027 of file wayland-client-protocol.hpp.
std::uint32_t wayland::subsurface_t::set_sync_since_version = 1 [static], [constexpr]
Minimum protocol version required for the set_sync function. ๐งฎ
Definition at line 4089 of file wayland-client-protocol.hpp.
๐ธ AUTHOR ๐ธ
Generated automatically by Doxygen for Wayland++ from the source code. So like, not a human author โ it's the Doxygen machine doing its thing. ๐ค๐
That's a wrap on wayland::subsurface_t(3), bestie: Version 1.0.1, dated Fri Mar 27 2026 13:15:00, Doxygen for Wayland++ from the source code. Periodt. ๐
โจ
๐ฆ where this page comes from
- ubuntu stonking: waylandpp-dev 1.0.1-2 ยท BSD-2-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms