diff options
| author | Matt Della <mrdella94@gmail.com> | 2019-11-27 16:43:16 -0800 |
|---|---|---|
| committer | Drew DeVault <sir@cmpwn.com> | 2019-11-27 19:53:07 -0500 |
| commit | a7404e109643bffb77cb63b6f22fc5d46a7cead2 (patch) | |
| tree | 3c6627fd4a77c5649e9dd4c7c7cd93050e6f9d95 /render.c | |
| parent | 426e1ce93d1344414bd3fa0eb7cd50d7ca9ec075 (diff) | |
Added option to adjust ring position via CLI arguments and the config file
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -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, |
