From a7404e109643bffb77cb63b6f22fc5d46a7cead2 Mon Sep 17 00:00:00 2001 From: Matt Della Date: Wed, 27 Nov 2019 16:43:16 -0800 Subject: Added option to adjust ring position via CLI arguments and the config file --- render.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 30d3f31..65ef47c 100644 --- a/render.c +++ b/render.c @@ -80,10 +80,26 @@ void render_frame(struct swaylock_surface *surface) { int new_width = buffer_diameter; int new_height = buffer_diameter; - int subsurf_xpos = surface->width / 2 - - buffer_width / (2 * surface->scale) + 2 / surface->scale; - int subsurf_ypos = surface->height / 2 - - (state->args.radius + state->args.thickness); + int subsurf_xpos; + int subsurf_ypos; + + // Center the indicator unless overridden by the user + if (state->args.override_indicator_x_position) { + subsurf_xpos = state->args.indicator_x_position - + buffer_width / (2 * surface->scale) + 2 / surface->scale; + } else { + subsurf_xpos = surface->width / 2 - + buffer_width / (2 * surface->scale) + 2 / surface->scale; + } + + if (state->args.override_indicator_y_position) { + subsurf_ypos = state->args.indicator_y_position - + (state->args.radius + state->args.thickness); + } else { + subsurf_ypos = surface->height / 2 - + (state->args.radius + state->args.thickness); + } + wl_subsurface_set_position(surface->subsurface, subsurf_xpos, subsurf_ypos); surface->current_buffer = get_next_buffer(state->shm, -- cgit v1.2.3