diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 54 |
1 files changed, 8 insertions, 46 deletions
@@ -163,59 +163,19 @@ static void ext_session_lock_surface_v1_handle_configure(void *data, surface->width = width; surface->height = height; ext_session_lock_surface_v1_ack_configure(lock_surface, serial); - render_frame_background(surface); - render_frame(surface); + surface->dirty = true; + render(surface); } static const struct ext_session_lock_surface_v1_listener ext_session_lock_surface_v1_listener = { .configure = ext_session_lock_surface_v1_handle_configure, }; -static const struct wl_callback_listener surface_frame_listener; - -static void surface_frame_handle_done(void *data, struct wl_callback *callback, - uint32_t time) { - struct swaylock_surface *surface = data; - - wl_callback_destroy(callback); - surface->frame_pending = false; - - if (surface->dirty) { - // Schedule a frame in case the surface is damaged again - struct wl_callback *callback = wl_surface_frame(surface->surface); - wl_callback_add_listener(callback, &surface_frame_listener, surface); - surface->frame_pending = true; - - render_frame(surface); - surface->dirty = false; - } -} - -static const struct wl_callback_listener surface_frame_listener = { - .done = surface_frame_handle_done, -}; - -void damage_surface(struct swaylock_surface *surface) { - if (surface->width == 0 || surface->height == 0) { - // Not yet configured - return; - } - - surface->dirty = true; - if (surface->frame_pending) { - return; - } - - struct wl_callback *callback = wl_surface_frame(surface->surface); - wl_callback_add_listener(callback, &surface_frame_listener, surface); - surface->frame_pending = true; - wl_surface_commit(surface->surface); -} - void damage_state(struct swaylock_state *state) { struct swaylock_surface *surface; wl_list_for_each(surface, &state->surfaces, link) { - damage_surface(surface); + surface->dirty = true; + render(surface); } } @@ -226,7 +186,8 @@ static void handle_wl_output_geometry(void *data, struct wl_output *wl_output, struct swaylock_surface *surface = data; surface->subpixel = subpixel; if (surface->state->run_display) { - damage_surface(surface); + surface->dirty = true; + render(surface); } } @@ -247,7 +208,8 @@ static void handle_wl_output_scale(void *data, struct wl_output *output, struct swaylock_surface *surface = data; surface->scale = factor; if (surface->state->run_display) { - damage_surface(surface); + surface->dirty = true; + render(surface); } } |
