aboutsummaryrefslogtreecommitdiff
path: root/include/rootston/seat.h
blob: a91d848101554dd20eef8b5359916043c7f09e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#ifndef ROOTSTON_SEAT_H
#define ROOTSTON_SEAT_H

#include <wayland-server.h>
#include "rootston/input.h"
#include "rootston/keyboard.h"
#include "rootston/layers.h"
#include "rootston/switch.h"
#include "rootston/text_input.h"

struct roots_seat {
	struct roots_input *input;
	struct wlr_seat *seat;
	struct roots_cursor *cursor;
	struct wl_list link; // roots_input::seats

	// coordinates of the first touch point if it exists
	int32_t touch_id;
	double touch_x, touch_y;

	// If the focused layer is set, views cannot receive keyboard focus
	struct wlr_layer_surface_v1 *focused_layer;

	struct roots_input_method_relay im_relay;

	// If non-null, only this client can receive input events
	struct wl_client *exclusive_client;

	struct wl_list views; // roots_seat_view::link
	bool has_focus;

	struct roots_drag_icon *drag_icon; // can be NULL

	struct wl_list keyboards;
	struct wl_list pointers;
	struct wl_list switches;
	struct wl_list touch;
	struct wl_list tablets;
	struct wl_list tablet_pads;

	struct wl_listener request_set_selection;
	struct wl_listener request_set_primary_selection;
	struct wl_listener new_drag_icon;
	struct wl_listener destroy;
};

struct roots_seat_view {
	struct roots_seat *seat;
	struct roots_view *view;

	bool has_button_grab;
	double grab_sx;
	double grab_sy;

	struct wl_list link; // roots_seat::views

	struct wl_listener view_unmap;
	struct wl_listener view_destroy;
};

struct roots_drag_icon {
	struct roots_seat *seat;
	struct wlr_drag_icon *wlr_drag_icon;

	double x, y;

	struct wl_listener surface_commit;
	struct wl_listener map;
	struct wl_listener unmap;
	struct wl_listener destroy;
};

struct roots_pointer {
	struct roots_seat *seat;
	struct wlr_input_device *device;
	struct wl_listener device_destroy;
	struct wl_list link;
};

struct roots_touch {
	struct roots_seat *seat;
	struct wlr_input_device *device;
	struct wl_listener device_destroy;
	struct wl_list link;
};

struct roots_tablet {
	struct roots_seat *seat;
	struct wlr_input_device *device;
	struct wlr_tablet_v2_tablet *tablet_v2;

	struct wl_listener device_destroy;
	struct wl_listener axis;
	struct wl_listener proximity;
	struct wl_listener tip;
	struct wl_listener button;
	struct wl_list link;
};

struct roots_tablet_pad {
	struct wl_list link;
	struct wlr_tablet_v2_tablet_pad *tablet_v2_pad;

	struct roots_seat *seat;
	struct wlr_input_device *device;

	struct wl_listener device_destroy;
	struct wl_listener attach;
	struct wl_listener button;
	struct wl_listener ring;
	struct wl_listener strip;

	struct roots_tablet *tablet;
	struct wl_listener tablet_destroy;
};

struct roots_tablet_tool {
	struct wl_list link;
	struct wl_list tool_link;
	struct wlr_tablet_v2_tablet_tool *tablet_v2_tool;

	struct roots_seat *seat;
	double tilt_x, tilt_y;

	struct wl_listener set_cursor;
	struct wl_listener tool_destroy;

	struct roots_tablet *current_tablet;
	struct wl_listener tablet_destroy;
};

struct roots_pointer_constraint {
	struct wlr_pointer_constraint_v1 *constraint;

	struct wl_listener destroy;
};

struct roots_seat *roots_seat_create(struct roots_input *input, char *name);

void roots_seat_destroy(struct roots_seat *seat);

void roots_seat_add_device(struct roots_seat *seat,
		struct wlr_input_device *device);

void roots_seat_configure_cursor(struct roots_seat *seat);

void roots_seat_configure_xcursor(struct roots_seat *seat);

bool roots_seat_has_meta_pressed(struct roots_seat *seat);

struct roots_view *roots_seat_get_focus(struct roots_seat *seat);

void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view);

void roots_seat_set_focus_layer(struct roots_seat *seat,
		struct wlr_layer_surface_v1 *layer);

void roots_seat_cycle_focus(struct roots_seat *seat);

void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view);

void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
		uint32_t edges);

void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view);

void roots_seat_end_compositor_grab(struct roots_seat *seat);

struct roots_seat_view *roots_seat_view_from_view( struct roots_seat *seat,
	struct roots_view *view);

void roots_drag_icon_update_position(struct roots_drag_icon *icon);

void roots_drag_icon_damage_whole(struct roots_drag_icon *icon);

void roots_seat_set_exclusive_client(struct roots_seat *seat,
		struct wl_client *client);

bool roots_seat_allow_input(struct roots_seat *seat,
		struct wl_resource *resource);

#endif