aboutsummaryrefslogtreecommitdiffstats
path: root/include/wth-receiver-seat.h
blob: ed011098a15af347c672e52498d1803be6250805 (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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*
 * Copyright © 2019 Advanced Driver Information Technology GmbH
 * Copyright © 2020 Collabora, Ltd.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#ifndef WTH_SERVER_WALTHAM_SEAT_H_
#define WTH_SERVER_WALTHAM_SEAT_H_

struct pointer;
struct touch;
struct window;
struct receiver;
struct client;

struct wthp_seat;

enum wthp_seat_capability {
    /**
     * the seat has pointer devices
     */
    WTHP_SEAT_CAPABILITY_POINTER = 1,
    /**
     * the seat has one or more keyboards
     */
    WTHP_SEAT_CAPABILITY_KEYBOARD = 2,
    /**
     * the seat has touch devices
     */
    WTHP_SEAT_CAPABILITY_TOUCH = 4,
};


/* wthp_seat protocol object */
struct seat {
    struct wthp_seat *obj;
    struct client *client;
    struct pointer *pointer;
    struct keyboard *keyboard;
    struct touch *touch;
    struct wl_list link; /* struct client::seat_list */
};

/* wthp_pointer protocol object */
struct pointer {
    struct wthp_pointer *obj;
    struct seat *seat;
    struct wl_list link; /* struct client::pointer_list */
};

/* wthp_keyboard protocol object */
struct keyboard {
    struct wthp_keyboard *obj;
    struct seat *seat;
    struct wl_list link; /* struct client::keyboard_list */
};

/* wthp_touch protocol object */
struct touch {
    struct wthp_touch *obj;
    struct seat *seat;
    struct wl_list link; /* struct client::touch_list */
};


/**
* waltham_pointer_enter
*
* Send pointer enter event received from weston to waltham client
*
* @param names        struct window *window
*             uint32_t serial
*             wl_fixed_t sx
*             wl_fixed_t sy
* @param value        window - window information
*                     serial - serial number of the enter event
*             sx     - surface-local x coordinate
*             sy     - surface-local y coordinate
* @return             none
*/
void waltham_pointer_enter(struct window *window, uint32_t serial,
                      wl_fixed_t sx, wl_fixed_t sy);

/**
* waltham_pointer_leave
*
* Send pointer leave event received from weston to waltham client
*
* @param names        struct window *window
*             uint32_t serial
* @param value        window - window information
*                     serial - serial number of the leave event
* @return             none
*/
void waltham_pointer_leave(struct window *window, uint32_t serial);

/**
* waltham_pointer_motion
*
* Send pointer motion event received from weston to waltham client
*
* @param names        struct window *window
*             uint32_t time
*             wl_fixed_t sx
*             wl_fixed_t sy
* @param value        window - window information
*                     time   - timestamp with millisecond granularity
*             sx     - surface-local x coordinate
*             sy     - surface-local y coordinate
* @return             none
*/
void waltham_pointer_motion(struct window *window, uint32_t time,
                       wl_fixed_t sx, wl_fixed_t sy);

/**
* waltham_pointer_button
*
* Send pointer button event received from weston to waltham client
*
* @param names        struct window *window
*             uint32_t serial
*             uint32_t time
*                     uint32_t button
*             uint32_t state
* @param value        window - window information
*             serial - serial number of the button event
*                     time   - timestamp with millisecond granularity
*             button - button that produced the event
*             state  - physical state of the button
* @return             none
*/
void waltham_pointer_button(struct window *window, uint32_t serial,
               uint32_t time, uint32_t button,
               uint32_t state);

/**
* waltham_pointer_axis
*
* Send pointer axis event received from weston to waltham client
*
* @param names        struct window *window
*             uint32_t time
*             uint32_t axis
*             wl_fixed_t value
* @param value        window - window information
*             time   - timestamp with millisecond granularity
*             axis   - axis type
*                     value  - length of vector in surface-local coordinate space
* @return             none
*/
void waltham_pointer_axis(struct window *window, uint32_t time,
             uint32_t axis, wl_fixed_t value);

/**
* waltham_touch_down
*
* Send touch down event received from weston to waltham client
*
* @param names     struct window *window
*          uint32_t serial
*                  uint32_t time
*          int32_t id
*          wl_fixed_t x_w
*          wl_fixed_t y_w
* @param value     window - window information
*          serial - serial number of the touch down event
*          time   - timestamp with millisecond granularity
*          id     - the unique ID of this touch point
*          x_w    - surface-local x coordinate
*          y_w    - surface-local y coordinate
* @return          none
*/
void waltham_touch_down(struct window *window, uint32_t serial,
                   uint32_t time, int32_t id,
           wl_fixed_t x_w, wl_fixed_t y_w);

/**
* waltham_touch_up
*
* Send touch up event received from weston to waltham client
*
* @param names     struct window *window
*          uint32_t serial
*                  uint32_t time
*          int32_t id
* @param value     window - window information
*          serial - serial number of the touch up event
*          time   - timestamp with millisecond granularity
*          id     - the unique ID of this touch point
* @return          none
*/
void waltham_touch_up(struct window *window, uint32_t serial,
                 uint32_t time, int32_t id);

/**
* waltham_touch_motion
*
* Send touch motion event received from weston to waltham client
*
* @param names     struct window *window
*                  uint32_t time
*          int32_t id
*          wl_fixed_t x_w
*          wl_fixed_t y_w
* @param value     window - window information
*          time   - timestamp with millisecond granularity
*          id     - the unique ID of this touch point
*          x_w    - surface-local x coordinate
*          y_w    - surface-local y coordinate
* @return          none
*/
void waltham_touch_motion(struct window *window, uint32_t time,
             int32_t id, wl_fixed_t x_w, wl_fixed_t y_w);

/**
* waltham_touch_frame
*
* Send touch frame event received from weston to waltham client
*
* @param names        struct window *window
* @param value        window - window information
* @return             none
*/
void waltham_touch_frame(struct window *window);

/**
* waltham_touch_cancel
*
* Send touch cancel event received from weston to waltham client
*
* @param names        struct window *window
* @param value        window - window information
* @return             none
*/
void waltham_touch_cancel(struct window *window);

void
client_bind_seat(struct client *c, struct wthp_seat *obj);

void
seat_send_updated_caps(struct seat *seat);

#endif