summaryrefslogtreecommitdiff
path: root/include/swaylock.h
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2024-09-07 00:27:37 +0200
committerAlexander Orzechowski <alex@ozal.ski>2024-09-06 19:46:24 -0400
commitcca2436ba535d17c49b7d7ba75ebfa6a18ec9209 (patch)
tree8b3f4cfc3ff55e5b8aad29d6629bb6f5664a2506 /include/swaylock.h
parentde0731de6a44d99532fcd46c5894cff5f10e65a6 (diff)
Improve frame callback and commit handling
The few places that required a surface commit relied on render_frame and render_frame_background to form it form them after they had set up frame callback events. This would fail if render_frame ran out of buffers and exited early, as the caller would still wait indefinitely on the frame callback. swaylock would quite consistently run out of buffers when rendering immediately after a configure event, such as when the keypress causing render also caused outputs to be enabled from idle. Restructure the render and commit handling slightly so that the whole frame callback and commit setup is handled by the render code, which now has a single render entrypoint. This both avoids stalls from lacking commits, but also fixes the case the configure path to respect frame callbacks so we do not run out of buffers in the first place.
Diffstat (limited to 'include/swaylock.h')
-rw-r--r--include/swaylock.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/swaylock.h b/include/swaylock.h
index c373fff..cd4e73e 100644
--- a/include/swaylock.h
+++ b/include/swaylock.h
@@ -113,12 +113,13 @@ struct swaylock_surface {
struct ext_session_lock_surface_v1 *ext_session_lock_surface_v1;
struct pool_buffer indicator_buffers[2];
bool created;
- bool frame_pending, dirty;
+ bool dirty;
uint32_t width, height;
int32_t scale;
enum wl_output_subpixel subpixel;
char *output_name;
struct wl_list link;
+ struct wl_callback *frame;
// Dimensions of last wl_buffer committed to background surface
int last_buffer_width, last_buffer_height;
};
@@ -133,9 +134,8 @@ struct swaylock_image {
void swaylock_handle_key(struct swaylock_state *state,
xkb_keysym_t keysym, uint32_t codepoint);
-void render_frame_background(struct swaylock_surface *surface);
-void render_frame(struct swaylock_surface *surface);
-void damage_surface(struct swaylock_surface *surface);
+
+void render(struct swaylock_surface *surface);
void damage_state(struct swaylock_state *state);
void clear_password_buffer(struct swaylock_password *pw);
void schedule_auth_idle(struct swaylock_state *state);