mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 18:09:49 +01:00
layer_shell: set layer of existing surface
This commit is contained in:
parent
6bb7639a0f
commit
1724261910
3 changed files with 29 additions and 4 deletions
|
@ -54,6 +54,7 @@ struct wlr_layer_surface_v1_state {
|
|||
bool keyboard_interactive;
|
||||
uint32_t desired_width, desired_height;
|
||||
uint32_t actual_width, actual_height;
|
||||
enum zwlr_layer_shell_v1_layer layer;
|
||||
};
|
||||
|
||||
struct wlr_layer_surface_v1_configure {
|
||||
|
@ -71,7 +72,6 @@ struct wlr_layer_surface_v1 {
|
|||
struct wl_list popups; // wlr_xdg_popup::link
|
||||
|
||||
char *namespace;
|
||||
enum zwlr_layer_shell_v1_layer layer;
|
||||
|
||||
bool added, configured, mapped, closed;
|
||||
uint32_t configure_serial;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="1">
|
||||
<interface name="zwlr_layer_shell_v1" version="2">
|
||||
<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
|
||||
|
@ -84,7 +84,7 @@
|
|||
</enum>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="1">
|
||||
<interface name="zwlr_layer_surface_v1" version="2">
|
||||
<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
|
||||
|
@ -231,6 +231,13 @@
|
|||
</description>
|
||||
</request>
|
||||
|
||||
<request name="set_layer" since="2">
|
||||
<description summary="change the layer of the surface">
|
||||
Change the layer that the surface is rendered on.
|
||||
</description>
|
||||
<arg name="layer" type="uint" enum="layer" summary="layer to move this surface to"/>
|
||||
</request>
|
||||
|
||||
<event name="configure">
|
||||
<description summary="suggest a surface change">
|
||||
The configure event asks the client to resize its surface.
|
||||
|
|
|
@ -173,6 +173,22 @@ static void layer_surface_handle_get_popup(struct wl_client *client,
|
|||
wlr_signal_emit_safe(&parent->events.new_popup, popup);
|
||||
}
|
||||
|
||||
static void layer_surface_set_layer(struct wl_client *client,
|
||||
struct wl_resource *surface_resource, uint32_t layer) {
|
||||
struct wlr_layer_surface_v1 *surface =
|
||||
layer_surface_from_resource(surface_resource);
|
||||
if (!surface) {
|
||||
return;
|
||||
}
|
||||
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
|
||||
wl_resource_post_error(surface->resource,
|
||||
ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER,
|
||||
"Invalid layer %d", layer);
|
||||
return;
|
||||
}
|
||||
surface->client_pending.layer = layer;
|
||||
}
|
||||
|
||||
static const struct zwlr_layer_surface_v1_interface layer_surface_implementation = {
|
||||
.destroy = resource_handle_destroy,
|
||||
.ack_configure = layer_surface_handle_ack_configure,
|
||||
|
@ -182,6 +198,7 @@ static const struct zwlr_layer_surface_v1_interface layer_surface_implementation
|
|||
.set_margin = layer_surface_handle_set_margin,
|
||||
.set_keyboard_interactivity = layer_surface_handle_set_keyboard_interactivity,
|
||||
.get_popup = layer_surface_handle_get_popup,
|
||||
.set_layer = layer_surface_set_layer,
|
||||
};
|
||||
|
||||
static void layer_surface_unmap(struct wlr_layer_surface_v1 *surface) {
|
||||
|
@ -315,6 +332,7 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
|
|||
surface->client_pending.keyboard_interactive;
|
||||
surface->current.desired_width = surface->client_pending.desired_width;
|
||||
surface->current.desired_height = surface->client_pending.desired_height;
|
||||
surface->current.layer = surface->client_pending.layer;
|
||||
|
||||
if (!surface->added) {
|
||||
surface->added = true;
|
||||
|
@ -375,7 +393,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
|
|||
if (output_resource) {
|
||||
surface->output = wlr_output_from_resource(output_resource);
|
||||
}
|
||||
surface->layer = layer;
|
||||
surface->current.layer = surface->client_pending.layer = layer;
|
||||
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
|
||||
free(surface);
|
||||
wl_resource_post_error(client_resource,
|
||||
|
|
Loading…
Reference in a new issue