Expose set_layer
The set_layer request allows to move a surface to another layer after creating it.
This commit is contained in:
parent
4ff7cf23c9
commit
b4c62f7926
|
@ -45,6 +45,11 @@ void Window::setKeyboardInteractivity(bool enabled)
|
|||
d->surface->setKeyboardInteractivity(enabled);
|
||||
}
|
||||
|
||||
void Window::setLayer(Layer layer)
|
||||
{
|
||||
d->surface->setLayer(layer);
|
||||
}
|
||||
|
||||
Window::Window(WindowPrivate *d)
|
||||
: d(d)
|
||||
{
|
||||
|
|
|
@ -31,10 +31,22 @@ public:
|
|||
};
|
||||
Q_ENUM(Anchor);
|
||||
|
||||
/**
|
||||
* This enum type is used to specify the layer where a surface can be put in.
|
||||
*/
|
||||
enum Layer {
|
||||
LayerBackground = 0,
|
||||
LayerBottom = 1,
|
||||
LayerTop = 2,
|
||||
LayerOverlay = 3,
|
||||
};
|
||||
Q_ENUM(Layer)
|
||||
|
||||
void setAnchor(Anchor anchor);
|
||||
void setExclusiveZone(int32_t zone);
|
||||
void setMargins(const QMargins &margins);
|
||||
void setKeyboardInteractivity(bool enabled);
|
||||
void setLayer(Layer layer);
|
||||
|
||||
static Window *get(QWindow *window);
|
||||
|
||||
|
|
|
@ -77,4 +77,10 @@ void QWaylandLayerSurface::setKeyboardInteractivity(bool enabled)
|
|||
set_keyboard_interactivity(enabled);
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::setLayer(uint32_t layer)
|
||||
{
|
||||
if (zwlr_layer_surface_v1_get_version(object()) >= ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION)
|
||||
set_layer(layer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
void setExclusiveZone(int32_t zone);
|
||||
void setMargins(const QMargins &margins);
|
||||
void setKeyboardInteractivity(bool enabled);
|
||||
void setLayer(uint32_t layer);
|
||||
|
||||
void applyConfigure() override;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="1">
|
||||
<interface name="zwlr_layer_shell_v1" version="3">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
|
@ -47,6 +47,12 @@
|
|||
or manipulate a buffer prior to the first layer_surface.configure call
|
||||
must also be treated as errors.
|
||||
|
||||
After creating a layer_surface object and setting it up, the client
|
||||
must perform an initial commit without any buffer attached.
|
||||
The compositor will reply with a layer_surface.configure event.
|
||||
The client must acknowledge it and is then allowed to attach a buffer
|
||||
to map the surface.
|
||||
|
||||
You may pass NULL for output to allow the compositor to decide which
|
||||
output to use. Generally this will be the one that the user most
|
||||
recently interacted with.
|
||||
|
@ -58,8 +64,7 @@
|
|||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
|
||||
<!-- NOTE: Renamed from `namespace` upstream -->
|
||||
<arg name="layer_namespace" type="string" summary="namespace for the layer surface"/>
|
||||
<arg name="scope" type="string" summary="namespace for the layer surface"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
|
@ -83,17 +88,35 @@
|
|||
<entry name="top" value="2"/>
|
||||
<entry name="overlay" value="3"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
|
||||
<request name="destroy" type="destructor" since="3">
|
||||
<description summary="destroy the layer_shell object">
|
||||
This request indicates that the client will not use the layer_shell
|
||||
object any more. Objects that have been created through this instance
|
||||
are not affected.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="1">
|
||||
<interface name="zwlr_layer_surface_v1" version="3">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
environment.
|
||||
|
||||
Layer surface state (size, anchor, exclusive zone, margin, interactivity)
|
||||
is double-buffered, and will be applied at the time wl_surface.commit of
|
||||
the corresponding wl_surface is called.
|
||||
Layer surface state (layer, size, anchor, exclusive zone,
|
||||
margin, interactivity) is double-buffered, and will be applied at the
|
||||
time wl_surface.commit of the corresponding wl_surface is called.
|
||||
|
||||
Attaching a null buffer to a layer surface unmaps it.
|
||||
|
||||
Unmapping a layer_surface means that the surface cannot be shown by the
|
||||
compositor until it is explicitly mapped again. The layer_surface
|
||||
returns to the state it had right after layer_shell.get_layer_surface.
|
||||
The client can re-map the surface by performing a commit without any
|
||||
buffer attached, waiting for a configure event and handling it as usual.
|
||||
</description>
|
||||
|
||||
<request name="set_size">
|
||||
|
@ -116,7 +139,7 @@
|
|||
<request name="set_anchor">
|
||||
<description summary="configures the anchor point of the surface">
|
||||
Requests that the compositor anchor the surface to the specified edges
|
||||
and corners. If two orthoginal edges are specified (e.g. 'top' and
|
||||
and corners. If two orthogonal edges are specified (e.g. 'top' and
|
||||
'left'), then the anchor point will be the intersection of the edges
|
||||
(e.g. the top left corner of the output); otherwise the anchor point
|
||||
will be centered on that edge, or in the center if none is specified.
|
||||
|
@ -128,20 +151,25 @@
|
|||
|
||||
<request name="set_exclusive_zone">
|
||||
<description summary="configures the exclusive geometry of this surface">
|
||||
Requests that the compositor avoids occluding an area of the surface
|
||||
with other surfaces. The compositor's use of this information is
|
||||
Requests that the compositor avoids occluding an area with other
|
||||
surfaces. The compositor's use of this information is
|
||||
implementation-dependent - do not assume that this region will not
|
||||
actually be occluded.
|
||||
|
||||
A positive value is only meaningful if the surface is anchored to an
|
||||
edge, rather than a corner. The zone is the number of surface-local
|
||||
coordinates from the edge that are considered exclusive.
|
||||
A positive value is only meaningful if the surface is anchored to one
|
||||
edge or an edge and both perpendicular edges. If the surface is not
|
||||
anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||
to only two parallel edges or anchored to all edges, a positive value
|
||||
will be treated the same as zero.
|
||||
|
||||
A positive zone is the distance from the edge in surface-local
|
||||
coordinates to consider exclusive.
|
||||
|
||||
Surfaces that do not wish to have an exclusive zone may instead specify
|
||||
how they should interact with surfaces that do. If set to zero, the
|
||||
surface indicates that it would like to be moved to avoid occluding
|
||||
surfaces with a positive excluzive zone. If set to -1, the surface
|
||||
indicates that it would not like to be moved to accomodate for other
|
||||
surfaces with a positive exclusive zone. If set to -1, the surface
|
||||
indicates that it would not like to be moved to accommodate for other
|
||||
surfaces, and the compositor should extend it all the way to the edges
|
||||
it is anchored to.
|
||||
|
||||
|
@ -282,5 +310,16 @@
|
|||
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
||||
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<request name="set_layer" since="2">
|
||||
<description summary="change the layer of the surface">
|
||||
Change the layer that the surface is rendered on.
|
||||
|
||||
Layer is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
|
Loading…
Reference in a new issue