diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-12 20:19:54 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-12 20:19:54 -0400 |
commit | cd1b32453a9296c18b28bff71607aeb22987b5cd (patch) | |
tree | c653c6d525b471914c01a9d7ae543f521b6138ed /include/swaylock | |
parent | Merge pull request #1634 from aleksander/master (diff) | |
parent | Fix separator height calculation (diff) | |
download | sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.tar.gz sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.tar.zst sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.zip |
Merge branch 'wlroots'
Diffstat (limited to 'include/swaylock')
-rw-r--r-- | include/swaylock/seat.h | 38 | ||||
-rw-r--r-- | include/swaylock/swaylock.h | 98 |
2 files changed, 86 insertions, 50 deletions
diff --git a/include/swaylock/seat.h b/include/swaylock/seat.h new file mode 100644 index 00000000..44bc37d5 --- /dev/null +++ b/include/swaylock/seat.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef _SWAYLOCK_SEAT_H | ||
2 | #define _SWAYLOCK_SEAT_H | ||
3 | #include <xkbcommon/xkbcommon.h> | ||
4 | |||
5 | enum mod_bit { | ||
6 | MOD_SHIFT = 1<<0, | ||
7 | MOD_CAPS = 1<<1, | ||
8 | MOD_CTRL = 1<<2, | ||
9 | MOD_ALT = 1<<3, | ||
10 | MOD_MOD2 = 1<<4, | ||
11 | MOD_MOD3 = 1<<5, | ||
12 | MOD_LOGO = 1<<6, | ||
13 | MOD_MOD5 = 1<<7, | ||
14 | }; | ||
15 | |||
16 | enum mask { | ||
17 | MASK_SHIFT, | ||
18 | MASK_CAPS, | ||
19 | MASK_CTRL, | ||
20 | MASK_ALT, | ||
21 | MASK_MOD2, | ||
22 | MASK_MOD3, | ||
23 | MASK_LOGO, | ||
24 | MASK_MOD5, | ||
25 | MASK_LAST | ||
26 | }; | ||
27 | |||
28 | struct swaylock_xkb { | ||
29 | uint32_t modifiers; | ||
30 | struct xkb_state *state; | ||
31 | struct xkb_context *context; | ||
32 | struct xkb_keymap *keymap; | ||
33 | xkb_mod_mask_t masks[MASK_LAST]; | ||
34 | }; | ||
35 | |||
36 | extern const struct wl_seat_listener seat_listener; | ||
37 | |||
38 | #endif | ||
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 |