summaryrefslogtreecommitdiffstats
path: root/include/sway/input/seat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/input/seat.h')
-rw-r--r--include/sway/input/seat.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h
new file mode 100644
index 00000000..ff76841e
--- /dev/null
+++ b/include/sway/input/seat.h
@@ -0,0 +1,111 @@
1#ifndef _SWAY_INPUT_SEAT_H
2#define _SWAY_INPUT_SEAT_H
3
4#include <wlr/types/wlr_layer_shell.h>
5#include <wlr/types/wlr_seat.h>
6#include "sway/input/input-manager.h"
7
8struct sway_seat_device {
9 struct sway_seat *sway_seat;
10 struct sway_input_device *input_device;
11 struct sway_keyboard *keyboard;
12 struct wl_list link; // sway_seat::devices
13};
14
15struct sway_seat_container {
16 struct sway_seat *seat;
17 struct sway_container *container;
18
19 struct wl_list link; // sway_seat::focus_stack
20
21 struct wl_listener destroy;
22};
23
24struct sway_seat {
25 struct wlr_seat *wlr_seat;
26 struct sway_cursor *cursor;
27 struct sway_input_manager *input;
28
29 bool has_focus;
30 struct wl_list focus_stack; // list of containers in focus order
31
32 // If the focused layer is set, views cannot receive keyboard focus
33 struct wlr_layer_surface *focused_layer;
34
35 // If exclusive_client is set, no other clients will receive input events
36 struct wl_client *exclusive_client;
37
38 struct wl_listener focus_destroy;
39 struct wl_listener new_container;
40
41 struct wl_list devices; // sway_seat_device::link
42
43 struct wl_list link; // input_manager::seats
44};
45
46struct sway_seat *seat_create(struct sway_input_manager *input,
47 const char *seat_name);
48
49void seat_destroy(struct sway_seat *seat);
50
51void seat_add_device(struct sway_seat *seat,
52 struct sway_input_device *device);
53
54void seat_configure_device(struct sway_seat *seat,
55 struct sway_input_device *device);
56
57void seat_remove_device(struct sway_seat *seat,
58 struct sway_input_device *device);
59
60void seat_configure_xcursor(struct sway_seat *seat);
61
62void seat_set_focus(struct sway_seat *seat, struct sway_container *container);
63
64void seat_set_focus_warp(struct sway_seat *seat,
65 struct sway_container *container, bool warp);
66
67void seat_set_focus_surface(struct sway_seat *seat,
68 struct wlr_surface *surface);
69
70void seat_set_focus_layer(struct sway_seat *seat,
71 struct wlr_layer_surface *layer);
72
73void seat_set_exclusive_client(struct sway_seat *seat,
74 struct wl_client *client);
75
76struct sway_container *seat_get_focus(struct sway_seat *seat);
77
78/**
79 * Return the last container to be focused for the seat (or the most recently
80 * opened if no container has received focused) that is a child of the given
81 * container. The focus-inactive container of the root window is the focused
82 * container for the seat (if the seat does have focus). This function can be
83 * used to determine what container gets focused next if the focused container
84 * is destroyed, or focus moves to a container with children and we need to
85 * descend into the next leaf in focus order.
86 */
87struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
88 struct sway_container *container);
89
90/**
91 * Descend into the focus stack to find the focus-inactive view. Useful for
92 * container placement when they change position in the tree.
93 */
94struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat,
95 struct sway_container *container);
96
97/**
98 * Iterate over the focus-inactive children of the container calling the
99 * function on each.
100 */
101void seat_focus_inactive_children_for_each(struct sway_seat *seat,
102 struct sway_container *container,
103 void (*f)(struct sway_container *container, void *data), void *data);
104
105void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config);
106
107struct seat_config *seat_get_config(struct sway_seat *seat);
108
109bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
110
111#endif