diff options
Diffstat (limited to 'include/swaylock/swaylock.h')
-rw-r--r-- | include/swaylock/swaylock.h | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/include/swaylock/swaylock.h b/include/swaylock/swaylock.h index eeed094e..173e8b12 100644 --- a/include/swaylock/swaylock.h +++ b/include/swaylock/swaylock.h | |||
@@ -1,66 +1,64 @@ | |||
1 | #ifndef _SWAYLOCK_H | 1 | #ifndef _SWAYLOCK_H |
2 | #define _SWAYLOCK_H | 2 | #define _SWAYLOCK_H |
3 | 3 | #include <stdbool.h> | |
4 | #include "client/cairo.h" | 4 | #include <stdint.h> |
5 | 5 | #include <wayland-client.h> | |
6 | enum scaling_mode { | 6 | #include "background-image.h" |
7 | SCALING_MODE_STRETCH, | 7 | #include "cairo.h" |
8 | SCALING_MODE_FILL, | 8 | #include "pool-buffer.h" |
9 | SCALING_MODE_FIT, | 9 | #include "swaylock/seat.h" |
10 | SCALING_MODE_CENTER, | 10 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
11 | SCALING_MODE_TILE, | ||
12 | }; | ||
13 | 11 | ||
14 | enum auth_state { | 12 | enum auth_state { |
15 | AUTH_STATE_IDLE, | 13 | AUTH_STATE_IDLE, |
16 | AUTH_STATE_INPUT, | 14 | AUTH_STATE_INPUT, |
17 | AUTH_STATE_BACKSPACE, | 15 | AUTH_STATE_BACKSPACE, |
18 | AUTH_STATE_VALIDATING, | 16 | AUTH_STATE_VALIDATING, |
19 | AUTH_STATE_INVALID, | 17 | AUTH_STATE_INVALID, |
20 | }; | 18 | }; |
21 | 19 | ||
22 | enum line_source { | 20 | struct swaylock_args { |
23 | LINE_SOURCE_DEFAULT, | ||
24 | LINE_SOURCE_RING, | ||
25 | LINE_SOURCE_INSIDE, | ||
26 | }; | ||
27 | |||
28 | struct render_data { | ||
29 | list_t *surfaces; | ||
30 | // Output specific images | ||
31 | cairo_surface_t **images; | ||
32 | // OR one image for all outputs: | ||
33 | cairo_surface_t *image; | ||
34 | int num_images; | ||
35 | int color_set; | ||
36 | uint32_t color; | 21 | uint32_t color; |
37 | enum scaling_mode scaling_mode; | 22 | enum background_mode mode; |
38 | enum auth_state auth_state; | 23 | bool show_indicator; |
39 | }; | 24 | }; |
40 | 25 | ||
41 | struct lock_colors { | 26 | struct swaylock_password { |
42 | uint32_t inner_ring; | 27 | size_t size; |
43 | uint32_t outer_ring; | 28 | size_t len; |
29 | char *buffer; | ||
44 | }; | 30 | }; |
45 | 31 | ||
46 | struct lock_config { | 32 | struct swaylock_state { |
47 | char *font; | 33 | struct wl_display *display; |
48 | 34 | struct wl_compositor *compositor; | |
49 | struct { | 35 | struct zwlr_layer_shell_v1 *layer_shell; |
50 | uint32_t text; | 36 | struct zwlr_input_inhibit_manager_v1 *input_inhibit_manager; |
51 | uint32_t line; | 37 | struct wl_shm *shm; |
52 | uint32_t separator; | 38 | struct wl_list surfaces; |
53 | uint32_t input_cursor; | 39 | struct swaylock_args args; |
54 | uint32_t backspace_cursor; | 40 | struct swaylock_password password; |
55 | struct lock_colors normal; | 41 | struct swaylock_xkb xkb; |
56 | struct lock_colors validating; | 42 | enum auth_state auth_state; |
57 | struct lock_colors invalid; | 43 | bool run_display; |
58 | } colors; | 44 | }; |
59 | 45 | ||
60 | int radius; | 46 | struct swaylock_surface { |
61 | int thickness; | 47 | cairo_surface_t *image; |
48 | struct swaylock_state *state; | ||
49 | struct wl_output *output; | ||
50 | struct wl_surface *surface; | ||
51 | struct zwlr_layer_surface_v1 *layer_surface; | ||
52 | struct pool_buffer buffers[2]; | ||
53 | struct pool_buffer *current_buffer; | ||
54 | uint32_t width, height; | ||
55 | int32_t scale; | ||
56 | struct wl_list link; | ||
62 | }; | 57 | }; |
63 | 58 | ||
64 | void render(struct render_data* render_data, struct lock_config *config); | 59 | void swaylock_handle_key(struct swaylock_state *state, |
60 | xkb_keysym_t keysym, uint32_t codepoint); | ||
61 | void render_frame(struct swaylock_surface *surface); | ||
62 | void render_frames(struct swaylock_state *state); | ||
65 | 63 | ||
66 | #endif | 64 | #endif |