summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAnders Nylander <nylander.anders@yandex.com>2019-03-12 11:16:33 +0100
committeremersion <contact@emersion.fr>2019-03-20 23:07:31 +0200
commit7d5a73b0a99ca9b4c73a34faceda8bef2576fe23 (patch)
treed65ebcb51592e82a849d89d63d64bd24db7c61e7 /main.c
parent6b3be42264b9eaa8524ea4f0d93fbd1d82495d90 (diff)
Decouple the drawing of the background from drawing the indicator.
* Render background only once in main wl_surface * Render indicator on subsurface
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.c b/main.c
index 6160377..b80fdbb 100644
--- a/main.c
+++ b/main.c
@@ -126,6 +126,12 @@ static void create_layer_surface(struct swaylock_surface *surface) {
surface->surface = wl_compositor_create_surface(state->compositor);
assert(surface->surface);
+ surface->child = wl_compositor_create_surface(state->compositor);
+ assert(surface->child);
+ surface->subsurface = wl_subcompositor_get_subsurface(state->subcompositor, surface->child, surface->surface);
+ assert(surface->subsurface);
+ wl_subsurface_set_sync(surface->subsurface);
+
surface->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
state->layer_shell, surface->surface, surface->output,
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "lockscreen");
@@ -163,6 +169,7 @@ static void layer_surface_configure(void *data,
surface->width = width;
surface->height = height;
zwlr_layer_surface_v1_ack_configure(layer_surface, serial);
+ render_frame_background(surface);
render_frame(surface);
}
@@ -297,6 +304,9 @@ static void handle_global(void *data, struct wl_registry *registry,
if (strcmp(interface, wl_compositor_interface.name) == 0) {
state->compositor = wl_registry_bind(registry, name,
&wl_compositor_interface, 3);
+ } else if (strcmp(interface, wl_subcompositor_interface.name) == 0) {
+ state->subcompositor = wl_registry_bind(registry, name,
+ &wl_subcompositor_interface, 1);
} else if (strcmp(interface, wl_shm_interface.name) == 0) {
state->shm = wl_registry_bind(registry, name,
&wl_shm_interface, 1);