summaryrefslogtreecommitdiff
path: root/extras.c
diff options
context:
space:
mode:
Diffstat (limited to 'extras.c')
-rw-r--r--extras.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/extras.c b/extras.c
index 4e321ff..62599cd 100644
--- a/extras.c
+++ b/extras.c
@@ -46,11 +46,11 @@ static void i3lock_color_to_array(double *rgb16, const char *color) {
46} 46}
47 47
48 48
49static void i3clock_fetch_digital_clock_xy(int *x, 49static void i3lock_fetch_digital_clock_xy(int *x,
50 int *y, 50 int *y,
51 const i3lock_digital_clock_t *dc, 51 const i3lock_digital_clock_t *dc,
52 const uint32_t *resolution, 52 const uint32_t *resolution,
53 int text_length) { 53 int text_length) {
54 54
55 /* x */ 55 /* x */
56 if (dc->horizontal_alignment == I3LOCK_ALIGN_CENTER) { 56 if (dc->horizontal_alignment == I3LOCK_ALIGN_CENTER) {
@@ -75,7 +75,7 @@ static void i3clock_fetch_digital_clock_xy(int *x,
75} 75}
76 76
77 77
78static void i3clock_fetch_led_clock_xy(int *x, 78static void i3lock_fetch_led_clock_xy(int *x,
79 int *y, 79 int *y,
80 const i3lock_led_clock_t *lc, 80 const i3lock_led_clock_t *lc,
81 const uint32_t *resolution) { 81 const uint32_t *resolution) {
@@ -211,11 +211,11 @@ void i3lock_draw_digital_clock(cairo_t *cr,
211 for (screen = 0; screen < xr_screens; ++screen) { 211 for (screen = 0; screen < xr_screens; ++screen) {
212 screen_resolution[0] = xr_resolutions[screen].width; 212 screen_resolution[0] = xr_resolutions[screen].width;
213 screen_resolution[1] = xr_resolutions[screen].height; 213 screen_resolution[1] = xr_resolutions[screen].height;
214 i3clock_fetch_digital_clock_xy(&x, 214 i3lock_fetch_digital_clock_xy(&x,
215 &y, 215 &y,
216 dc, 216 dc,
217 screen_resolution, 217 screen_resolution,
218 strlen(current_time_str)); 218 strlen(current_time_str));
219 cairo_move_to(cr, 219 cairo_move_to(cr,
220 x + xr_resolutions[screen].x, 220 x + xr_resolutions[screen].x,
221 y + xr_resolutions[screen].y); 221 y + xr_resolutions[screen].y);
@@ -224,11 +224,11 @@ void i3lock_draw_digital_clock(cairo_t *cr,
224 return; 224 return;
225 } 225 }
226 226
227 i3clock_fetch_digital_clock_xy(&x, 227 i3lock_fetch_digital_clock_xy(&x,
228 &y, 228 &y,
229 dc, 229 dc,
230 resolution, 230 resolution,
231 strlen(current_time_str)); 231 strlen(current_time_str));
232 /* printf("%dx%d\n", *resolution, *(resolution + 1)); */ 232 /* printf("%dx%d\n", *resolution, *(resolution + 1)); */
233 cairo_move_to(cr, x, y); 233 cairo_move_to(cr, x, y);
234 cairo_show_text(cr, current_time_str); 234 cairo_show_text(cr, current_time_str);
@@ -244,7 +244,7 @@ void i3lock_draw_string(cairo_t *cr,
244 int x, y; 244 int x, y;
245 245
246 /* create a dummy i3lock_digital_clock_t structure in order to reuse 246 /* create a dummy i3lock_digital_clock_t structure in order to reuse
247 i3clock_fetch_digital_clock_xy */ 247 i3lock_fetch_digital_clock_xy */
248 i3lock_digital_clock_t dc = {et->text_size, 248 i3lock_digital_clock_t dc = {et->text_size,
249 "", 249 "",
250 "", 250 "",
@@ -263,11 +263,11 @@ void i3lock_draw_string(cairo_t *cr,
263 for (screen = 0; screen < xr_screens; ++screen) { 263 for (screen = 0; screen < xr_screens; ++screen) {
264 screen_resolution[0] = xr_resolutions[screen].width; 264 screen_resolution[0] = xr_resolutions[screen].width;
265 screen_resolution[1] = xr_resolutions[screen].height; 265 screen_resolution[1] = xr_resolutions[screen].height;
266 i3clock_fetch_digital_clock_xy(&x, 266 i3lock_fetch_digital_clock_xy(&x,
267 &y, 267 &y,
268 &dc, 268 &dc,
269 screen_resolution, 269 screen_resolution,
270 strlen(formatted_string)); 270 strlen(formatted_string));
271 cairo_move_to(cr, 271 cairo_move_to(cr,
272 x + xr_resolutions[screen].x, 272 x + xr_resolutions[screen].x,
273 y + xr_resolutions[screen].y); 273 y + xr_resolutions[screen].y);
@@ -276,11 +276,11 @@ void i3lock_draw_string(cairo_t *cr,
276 return; 276 return;
277 } 277 }
278 278
279 i3clock_fetch_digital_clock_xy(&x, 279 i3lock_fetch_digital_clock_xy(&x,
280 &y, 280 &y,
281 &dc, 281 &dc,
282 resolution, 282 resolution,
283 strlen(formatted_string)); 283 strlen(formatted_string));
284 /* printf("%dx%d\n", *resolution, *(resolution + 1)); */ 284 /* printf("%dx%d\n", *resolution, *(resolution + 1)); */
285 cairo_move_to(cr, x, y); 285 cairo_move_to(cr, x, y);
286 cairo_show_text(cr, formatted_string); 286 cairo_show_text(cr, formatted_string);
@@ -297,7 +297,7 @@ void i3lock_draw_elapsed_time(cairo_t *cr,
297 int x, y, seconds, minutes, hours, diff_seconds; 297 int x, y, seconds, minutes, hours, diff_seconds;
298 298
299 /* create a dummy i3lock_digital_clock_t structure in ordet to reuse 299 /* create a dummy i3lock_digital_clock_t structure in ordet to reuse
300 i3clock_fetch_digital_clock_xy */ 300 i3lock_fetch_digital_clock_xy */
301 i3lock_digital_clock_t dc = {et->text_size, 301 i3lock_digital_clock_t dc = {et->text_size,
302 "", 302 "",
303 "", 303 "",
@@ -339,11 +339,11 @@ void i3lock_draw_elapsed_time(cairo_t *cr,
339 for (screen = 0; screen < xr_screens; ++screen) { 339 for (screen = 0; screen < xr_screens; ++screen) {
340 screen_resolution[0] = xr_resolutions[screen].width; 340 screen_resolution[0] = xr_resolutions[screen].width;
341 screen_resolution[1] = xr_resolutions[screen].height; 341 screen_resolution[1] = xr_resolutions[screen].height;
342 i3clock_fetch_digital_clock_xy(&x, 342 i3lock_fetch_digital_clock_xy(&x,
343 &y, 343 &y,
344 &dc, 344 &dc,
345 screen_resolution, 345 screen_resolution,
346 strlen(elapsed_time_str)); 346 strlen(elapsed_time_str));
347 cairo_move_to(cr, 347 cairo_move_to(cr,
348 x + xr_resolutions[screen].x, 348 x + xr_resolutions[screen].x,
349 y + xr_resolutions[screen].y); 349 y + xr_resolutions[screen].y);
@@ -352,11 +352,11 @@ void i3lock_draw_elapsed_time(cairo_t *cr,
352 return; 352 return;
353 } 353 }
354 354
355 i3clock_fetch_digital_clock_xy(&x, 355 i3lock_fetch_digital_clock_xy(&x,
356 &y, 356 &y,
357 &dc, 357 &dc,
358 resolution, 358 resolution,
359 strlen(elapsed_time_str)); 359 strlen(elapsed_time_str));
360 /* printf("%dx%d\n", *resolution, *(resolution + 1)); */ 360 /* printf("%dx%d\n", *resolution, *(resolution + 1)); */
361 cairo_move_to(cr, x, y); 361 cairo_move_to(cr, x, y);
362 cairo_show_text(cr, elapsed_time_str); 362 cairo_show_text(cr, elapsed_time_str);
@@ -379,10 +379,10 @@ void i3lock_draw_led_clock(cairo_t *cr,
379 screen_resolution[1] = xr_resolutions[screen].height; 379 screen_resolution[1] = xr_resolutions[screen].height;
380 side_length = xr_resolutions[screen].height / I3LOCK_SCALE_LED_SPACING; 380 side_length = xr_resolutions[screen].height / I3LOCK_SCALE_LED_SPACING;
381 space_length = xr_resolutions[screen].height / I3LOCK_SCALE_LED_LENGTH; 381 space_length = xr_resolutions[screen].height / I3LOCK_SCALE_LED_LENGTH;
382 i3clock_fetch_led_clock_xy(&base_x, 382 i3lock_fetch_led_clock_xy(&base_x,
383 &base_y, 383 &base_y,
384 lc, 384 lc,
385 screen_resolution); 385 screen_resolution);
386 base_x += xr_resolutions[screen].x; 386 base_x += xr_resolutions[screen].x;
387 base_y += xr_resolutions[screen].y; 387 base_y += xr_resolutions[screen].y;
388 base_x_h = base_x + space_length / 2 + side_length / 2; 388 base_x_h = base_x + space_length / 2 + side_length / 2;