Skip to content

Commit

Permalink
Don't drop the buffer until after surface commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wmww authored and emersion committed Jun 12, 2023
1 parent 31ebd85 commit 2018673
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions render.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ void render_frame_background(struct swaylock_surface *surface) {
return; // not yet configured
}

wl_surface_set_buffer_scale(surface->surface, surface->scale);

if (buffer_width != surface->last_buffer_width ||
buffer_height != surface->last_buffer_height) {
struct pool_buffer buffer;
Expand Down Expand Up @@ -69,14 +71,14 @@ void render_frame_background(struct swaylock_surface *surface) {

wl_surface_attach(surface->surface, buffer.buffer, 0, 0);
wl_surface_damage_buffer(surface->surface, 0, 0, INT32_MAX, INT32_MAX);
wl_surface_commit(surface->surface);
destroy_buffer(&buffer);

surface->last_buffer_width = buffer_width;
surface->last_buffer_height = buffer_height;
} else {
wl_surface_commit(surface->surface);
}

wl_surface_set_buffer_scale(surface->surface, surface->scale);
wl_surface_commit(surface->surface);
}

static void configure_font_drawing(cairo_t *cairo, struct swaylock_state *state,
Expand Down

0 comments on commit 2018673

Please sign in to comment.