File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ struct swaylock_args {
5555 uint32_t font_size ;
5656 uint32_t radius ;
5757 uint32_t thickness ;
58- uint32_t indicator_x_position ;
59- uint32_t indicator_y_position ;
58+ int32_t indicator_x_position ;
59+ int32_t indicator_y_position ;
6060 bool override_indicator_x_position ;
6161 bool override_indicator_y_position ;
6262 bool ignore_empty ;
Original file line number Diff line number Diff line change @@ -192,16 +192,26 @@ void render_frame(struct swaylock_surface *surface) {
192192
193193 // Center the indicator unless overridden by the user
194194 if (state -> args .override_indicator_x_position ) {
195- subsurf_xpos = state -> args .indicator_x_position -
196- buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
195+ if (state -> args .indicator_x_position < 0 ) {
196+ subsurf_xpos = surface -> width + state -> args .indicator_x_position -
197+ buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
198+ } else {
199+ subsurf_xpos = state -> args .indicator_x_position -
200+ buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
201+ }
197202 } else {
198203 subsurf_xpos = surface -> width / 2 -
199204 buffer_width / (2 * surface -> scale ) + 2 / surface -> scale ;
200205 }
201206
202207 if (state -> args .override_indicator_y_position ) {
203- subsurf_ypos = state -> args .indicator_y_position -
204- (state -> args .radius + state -> args .thickness );
208+ if (state -> args .indicator_y_position < 0 ) {
209+ subsurf_ypos = surface -> height + state -> args .indicator_y_position -
210+ (state -> args .radius + state -> args .thickness );
211+ } else {
212+ subsurf_ypos = state -> args .indicator_y_position -
213+ (state -> args .radius + state -> args .thickness );
214+ }
205215 } else {
206216 subsurf_ypos = surface -> height / 2 -
207217 (state -> args .radius + state -> args .thickness );
You can’t perform that action at this time.
0 commit comments