1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
* This file is part of i3lock-extended
* Copyright (C) 2020-2024 Simeon Simeonov
* i3lock-extended is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* i3lock-extended is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EXTRAS_H
#define EXTRAS_H
#include <time.h>
#define I3LOCK_SCALE_LED_LENGTH 60
#define I3LOCK_SCALE_LED_SPACING 30
typedef enum {
I3LOCK_ALIGN_LEFT = 0,
I3LOCK_ALIGN_CENTER,
I3LOCK_ALIGN_RIGHT
} i3lock_horizontal_alignment;
typedef enum {
I3LOCK_ALIGN_TOP = 0,
I3LOCK_ALIGN_MIDDLE,
I3LOCK_ALIGN_BOTTOM
} i3lock_vertical_alignment;
typedef struct i3lock_digital_clock_t_ {
int text_size;
char color[7];
char *template;
i3lock_horizontal_alignment horizontal_alignment;
i3lock_vertical_alignment vertical_alignment;
} i3lock_digital_clock_t;
typedef struct i3lock_elapsed_time_t_ {
int text_size;
char color[7];
time_t start_time;
i3lock_horizontal_alignment horizontal_alignment;
i3lock_vertical_alignment vertical_alignment;
} i3lock_elapsed_time_t;
typedef struct i3lock_led_clock_t_ {
char led_on_color[7];
char led_off_color[7];
char led_border_color[7];
i3lock_horizontal_alignment horizontal_alignment;
i3lock_vertical_alignment vertical_alignment;
} i3lock_led_clock_t;
void i3lock_draw_digital_clock(cairo_t *cr,
const i3lock_digital_clock_t *dc,
const uint32_t *resolution,
const struct tm *brokentime);
void i3lock_draw_elapsed_time(cairo_t *cr,
const i3lock_elapsed_time_t *et,
const uint32_t *resolution,
const time_t *now);
void i3lock_draw_led_clock(cairo_t *cr,
const i3lock_led_clock_t *lc,
const uint32_t *resolution,
const struct tm *brokentime);
void i3lock_draw_string(cairo_t *cr,
const char *formatted_string,
const i3lock_elapsed_time_t *et,
const uint32_t *resolution);
char * i3lock_format_elapsed_time(char *to,
const char *template,
int max_size,
int seconds);
#endif
|