aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-04-02 23:14:37 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-04-04 18:47:48 -0400
commit1008d4cc9105e18074f8152ec5d6679aef8ebc5f (patch)
tree7ea62bc43f58f50477f0ee3edb44076944f19d02 /include
parentSet up an XKB context for the keyboard (diff)
downloadsway-1008d4cc9105e18074f8152ec5d6679aef8ebc5f.tar.gz
sway-1008d4cc9105e18074f8152ec5d6679aef8ebc5f.tar.zst
sway-1008d4cc9105e18074f8152ec5d6679aef8ebc5f.zip
Split seat code into its own file
Diffstat (limited to 'include')
-rw-r--r--include/swaylock/seat.h38
-rw-r--r--include/swaylock/swaylock.h87
2 files changed, 69 insertions, 56 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
5enum 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
16enum 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
28struct 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
36extern const struct wl_seat_listener seat_listener;
37
38#endif
diff --git a/include/swaylock/swaylock.h b/include/swaylock/swaylock.h
index eeed094e..e2673aae 100644
--- a/include/swaylock/swaylock.h
+++ b/include/swaylock/swaylock.h
@@ -1,66 +1,41 @@
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>
6enum 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, 11
12}; 12struct swaylock_args {
13
14enum auth_state {
15 AUTH_STATE_IDLE,
16 AUTH_STATE_INPUT,
17 AUTH_STATE_BACKSPACE,
18 AUTH_STATE_VALIDATING,
19 AUTH_STATE_INVALID,
20};
21
22enum line_source {
23 LINE_SOURCE_DEFAULT,
24 LINE_SOURCE_RING,
25 LINE_SOURCE_INSIDE,
26};
27
28struct 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; 13 uint32_t color;
37 enum scaling_mode scaling_mode; 14 enum background_mode mode;
38 enum auth_state auth_state; 15 bool show_indicator;
39}; 16};
40 17
41struct lock_colors { 18struct swaylock_state {
42 uint32_t inner_ring; 19 struct wl_display *display;
43 uint32_t outer_ring; 20 struct wl_compositor *compositor;
21 struct zwlr_layer_shell_v1 *layer_shell;
22 struct wl_shm *shm;
23 struct wl_list contexts;
24 struct swaylock_args args;
25 struct swaylock_xkb xkb;
26 bool run_display;
44}; 27};
45 28
46struct lock_config { 29struct swaylock_context {
47 char *font; 30 cairo_surface_t *image;
48 31 struct swaylock_state *state;
49 struct { 32 struct wl_output *output;
50 uint32_t text; 33 struct wl_surface *surface;
51 uint32_t line; 34 struct zwlr_layer_surface_v1 *layer_surface;
52 uint32_t separator; 35 struct pool_buffer buffers[2];
53 uint32_t input_cursor; 36 struct pool_buffer *current_buffer;
54 uint32_t backspace_cursor; 37 uint32_t width, height;
55 struct lock_colors normal; 38 struct wl_list link;
56 struct lock_colors validating;
57 struct lock_colors invalid;
58 } colors;
59
60 int radius;
61 int thickness;
62}; 39};
63 40
64void render(struct render_data* render_data, struct lock_config *config);
65
66#endif 41#endif