diff options
Diffstat (limited to 'include/sway/input/seat.h')
-rw-r--r-- | include/sway/input/seat.h | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index c10b48b1..d2f14895 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -6,6 +6,17 @@ | |||
6 | #include <wlr/util/edges.h> | 6 | #include <wlr/util/edges.h> |
7 | #include "sway/input/input-manager.h" | 7 | #include "sway/input/input-manager.h" |
8 | 8 | ||
9 | struct sway_seat; | ||
10 | |||
11 | struct sway_seatop_impl { | ||
12 | void (*motion)(struct sway_seat *seat, uint32_t time_msec); | ||
13 | void (*finish)(struct sway_seat *seat); | ||
14 | void (*abort)(struct sway_seat *seat); | ||
15 | void (*unref)(struct sway_seat *seat, struct sway_container *con); | ||
16 | void (*render)(struct sway_seat *seat, struct sway_output *output, | ||
17 | pixman_region32_t *damage); | ||
18 | }; | ||
19 | |||
9 | struct sway_seat_device { | 20 | struct sway_seat_device { |
10 | struct sway_seat *sway_seat; | 21 | struct sway_seat *sway_seat; |
11 | struct sway_input_device *input_device; | 22 | struct sway_input_device *input_device; |
@@ -35,16 +46,6 @@ struct sway_drag_icon { | |||
35 | struct wl_listener destroy; | 46 | struct wl_listener destroy; |
36 | }; | 47 | }; |
37 | 48 | ||
38 | enum sway_seat_operation { | ||
39 | OP_NONE, | ||
40 | OP_DOWN, | ||
41 | OP_MOVE_FLOATING, | ||
42 | OP_MOVE_TILING_THRESHOLD, | ||
43 | OP_MOVE_TILING, | ||
44 | OP_RESIZE_FLOATING, | ||
45 | OP_RESIZE_TILING, | ||
46 | }; | ||
47 | |||
48 | struct sway_seat { | 49 | struct sway_seat { |
49 | struct wlr_seat *wlr_seat; | 50 | struct wlr_seat *wlr_seat; |
50 | struct sway_cursor *cursor; | 51 | struct sway_cursor *cursor; |
@@ -64,19 +65,10 @@ struct sway_seat { | |||
64 | int32_t touch_id; | 65 | int32_t touch_id; |
65 | double touch_x, touch_y; | 66 | double touch_x, touch_y; |
66 | 67 | ||
67 | // Operations (drag and resize) | 68 | // Seat operations (drag and resize) |
68 | enum sway_seat_operation operation; | 69 | const struct sway_seatop_impl *seatop_impl; |
69 | struct sway_container *op_container; | 70 | void *seatop_data; |
70 | struct sway_node *op_target_node; // target for tiling move | 71 | uint32_t seatop_button; |
71 | enum wlr_edges op_target_edge; | ||
72 | struct wlr_box op_drop_box; | ||
73 | enum wlr_edges op_resize_edge; | ||
74 | uint32_t op_button; | ||
75 | bool op_resize_preserve_ratio; | ||
76 | double op_ref_lx, op_ref_ly; // cursor's x/y at start of op | ||
77 | double op_ref_width, op_ref_height; // container's size at start of op | ||
78 | double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op | ||
79 | bool op_moved; // if the mouse moved during a down op | ||
80 | 72 | ||
81 | uint32_t last_button; | 73 | uint32_t last_button; |
82 | uint32_t last_button_serial; | 74 | uint32_t last_button_serial; |
@@ -184,32 +176,59 @@ bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface); | |||
184 | 176 | ||
185 | void drag_icon_update_position(struct sway_drag_icon *icon); | 177 | void drag_icon_update_position(struct sway_drag_icon *icon); |
186 | 178 | ||
187 | void seat_begin_down(struct sway_seat *seat, struct sway_container *con, | 179 | void seatop_begin_down(struct sway_seat *seat, |
188 | uint32_t button, double sx, double sy); | 180 | struct sway_container *con, uint32_t button, int sx, int sy); |
189 | 181 | ||
190 | void seat_begin_move_floating(struct sway_seat *seat, | 182 | void seatop_begin_move_floating(struct sway_seat *seat, |
191 | struct sway_container *con, uint32_t button); | 183 | struct sway_container *con, uint32_t button); |
192 | 184 | ||
193 | void seat_begin_move_tiling_threshold(struct sway_seat *seat, | 185 | void seatop_begin_move_tiling_threshold(struct sway_seat *seat, |
194 | struct sway_container *con, uint32_t button); | 186 | struct sway_container *con, uint32_t button); |
195 | 187 | ||
196 | void seat_begin_move_tiling(struct sway_seat *seat, | 188 | void seatop_begin_move_tiling(struct sway_seat *seat, |
197 | struct sway_container *con, uint32_t button); | 189 | struct sway_container *con, uint32_t button); |
198 | 190 | ||
199 | void seat_begin_resize_floating(struct sway_seat *seat, | 191 | void seatop_begin_resize_floating(struct sway_seat *seat, |
200 | struct sway_container *con, uint32_t button, enum wlr_edges edge); | 192 | struct sway_container *con, uint32_t button, enum wlr_edges edge); |
201 | 193 | ||
202 | void seat_begin_resize_tiling(struct sway_seat *seat, | 194 | void seatop_begin_resize_tiling(struct sway_seat *seat, |
203 | struct sway_container *con, uint32_t button, enum wlr_edges edge); | 195 | struct sway_container *con, uint32_t button, enum wlr_edges edge); |
204 | 196 | ||
205 | struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, | 197 | struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, |
206 | struct sway_workspace *workspace); | 198 | struct sway_workspace *workspace); |
207 | 199 | ||
208 | void seat_end_mouse_operation(struct sway_seat *seat); | ||
209 | |||
210 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, | 200 | void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, |
211 | uint32_t button, enum wlr_button_state state); | 201 | uint32_t button, enum wlr_button_state state); |
212 | 202 | ||
213 | void seat_consider_warp_to_focus(struct sway_seat *seat); | 203 | void seat_consider_warp_to_focus(struct sway_seat *seat); |
214 | 204 | ||
205 | bool seat_doing_seatop(struct sway_seat *seat); | ||
206 | |||
207 | void seatop_motion(struct sway_seat *seat, uint32_t time_msec); | ||
208 | |||
209 | /** | ||
210 | * End a seatop and apply the affects. | ||
211 | */ | ||
212 | void seatop_finish(struct sway_seat *seat); | ||
213 | |||
214 | /** | ||
215 | * End a seatop without applying the affects. | ||
216 | */ | ||
217 | void seatop_abort(struct sway_seat *seat); | ||
218 | |||
219 | /** | ||
220 | * Instructs the seatop implementation to drop any references to the given | ||
221 | * container (eg. because the container is destroying). | ||
222 | * The seatop may choose to abort itself in response to this. | ||
223 | */ | ||
224 | void seatop_unref(struct sway_seat *seat, struct sway_container *con); | ||
225 | |||
226 | /** | ||
227 | * Instructs a seatop to render anything that it needs to render | ||
228 | * (eg. dropzone for move-tiling) | ||
229 | */ | ||
230 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | ||
231 | pixman_region32_t *damage); | ||
232 | |||
233 | |||
215 | #endif | 234 | #endif |