summaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2023-03-28 19:42:19 -0400
committerKenny Levinsen <kl@kl.wtf>2023-04-02 02:34:19 +0200
commit75e837c31abe2fa06167b6f1f1a253ab397faf81 (patch)
treebdf655e80382c2555326fe3e3adc446b1e9902cc /render.c
parent1d3e62c67f07a180fca02a6df1cf9648f2b50349 (diff)
Synchronize highlight position between outputs
This change has the additional benefit of ensuring that the position of the highlight only changes in reaction to a letter key or backspace being pressed, and not when the compositor sends a new configure event or the output needs to be redrawn for some other reason.
Diffstat (limited to 'render.c')
-rw-r--r--render.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/render.c b/render.c
index b7febc1..fddacf3 100644
--- a/render.c
+++ b/render.c
@@ -271,9 +271,7 @@ void render_frame(struct swaylock_surface *surface) {
// Typing indicator: Highlight random part on keypress
if (state->auth_state == AUTH_STATE_INPUT
|| state->auth_state == AUTH_STATE_BACKSPACE) {
- static double highlight_start = 0;
- highlight_start +=
- (rand() % (int)(M_PI * 100)) / 100.0 + M_PI * 0.5;
+ double highlight_start = state->highlight_start * (M_PI / 1024.0);
cairo_arc(cairo, buffer_width / 2, buffer_diameter / 2,
arc_radius, highlight_start,
highlight_start + TYPE_INDICATOR_RANGE);