diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-03 14:31:30 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-04 18:47:48 -0400 |
commit | 066143adef7adc6e76e43e1990db2f75fe984b42 (patch) | |
tree | f9509c14f04399bf02d2cc31ff62869a07691543 /include | |
parent | Link swaylock to xkbcommon (diff) | |
download | sway-066143adef7adc6e76e43e1990db2f75fe984b42.tar.gz sway-066143adef7adc6e76e43e1990db2f75fe984b42.tar.zst sway-066143adef7adc6e76e43e1990db2f75fe984b42.zip |
Add password buffer, refactor rendering/surfaces
Diffstat (limited to 'include')
-rw-r--r-- | include/swaylock/swaylock.h | 15 | ||||
-rw-r--r-- | include/unicode.h | 33 |
2 files changed, 46 insertions, 2 deletions
diff --git a/include/swaylock/swaylock.h b/include/swaylock/swaylock.h index e2673aae..f3b0b58b 100644 --- a/include/swaylock/swaylock.h +++ b/include/swaylock/swaylock.h | |||
@@ -15,18 +15,25 @@ struct swaylock_args { | |||
15 | bool show_indicator; | 15 | bool show_indicator; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct swaylock_password { | ||
19 | size_t size; | ||
20 | size_t len; | ||
21 | char *buffer; | ||
22 | }; | ||
23 | |||
18 | struct swaylock_state { | 24 | struct swaylock_state { |
19 | struct wl_display *display; | 25 | struct wl_display *display; |
20 | struct wl_compositor *compositor; | 26 | struct wl_compositor *compositor; |
21 | struct zwlr_layer_shell_v1 *layer_shell; | 27 | struct zwlr_layer_shell_v1 *layer_shell; |
22 | struct wl_shm *shm; | 28 | struct wl_shm *shm; |
23 | struct wl_list contexts; | 29 | struct wl_list surfaces; |
24 | struct swaylock_args args; | 30 | struct swaylock_args args; |
31 | struct swaylock_password password; | ||
25 | struct swaylock_xkb xkb; | 32 | struct swaylock_xkb xkb; |
26 | bool run_display; | 33 | bool run_display; |
27 | }; | 34 | }; |
28 | 35 | ||
29 | struct swaylock_context { | 36 | struct swaylock_surface { |
30 | cairo_surface_t *image; | 37 | cairo_surface_t *image; |
31 | struct swaylock_state *state; | 38 | struct swaylock_state *state; |
32 | struct wl_output *output; | 39 | struct wl_output *output; |
@@ -38,4 +45,8 @@ struct swaylock_context { | |||
38 | struct wl_list link; | 45 | struct wl_list link; |
39 | }; | 46 | }; |
40 | 47 | ||
48 | void swaylock_handle_key(struct swaylock_state *state, | ||
49 | xkb_keysym_t keysym, uint32_t codepoint); | ||
50 | void render_frame(struct swaylock_surface *surface); | ||
51 | |||
41 | #endif | 52 | #endif |
diff --git a/include/unicode.h b/include/unicode.h new file mode 100644 index 00000000..e2ee9588 --- /dev/null +++ b/include/unicode.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _SWAY_UNICODE_H | ||
2 | #define _SWAY_UNICODE_H | ||
3 | #include <stddef.h> | ||
4 | #include <stdint.h> | ||
5 | |||
6 | // Technically UTF-8 supports up to 6 byte codepoints, but Unicode itself | ||
7 | // doesn't really bother with more than 4. | ||
8 | #define UTF8_MAX_SIZE 4 | ||
9 | |||
10 | #define UTF8_INVALID 0x80 | ||
11 | |||
12 | /** | ||
13 | * Grabs the next UTF-8 character and advances the string pointer | ||
14 | */ | ||
15 | uint32_t utf8_decode(const char **str); | ||
16 | |||
17 | /** | ||
18 | * Encodes a character as UTF-8 and returns the length of that character. | ||
19 | */ | ||
20 | size_t utf8_encode(char *str, uint32_t ch); | ||
21 | |||
22 | /** | ||
23 | * Returns the size of the next UTF-8 character | ||
24 | */ | ||
25 | int utf8_size(const char *str); | ||
26 | |||
27 | /** | ||
28 | * Returns the size of a UTF-8 character | ||
29 | */ | ||
30 | size_t utf8_chsize(uint32_t ch); | ||
31 | |||
32 | #endif | ||
33 | |||