diff options
Diffstat (limited to 'sway/input/seatop_move_floating.c')
-rw-r--r-- | sway/input/seatop_move_floating.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sway/input/seatop_move_floating.c b/sway/input/seatop_move_floating.c index 21a2a966..b9a20402 100644 --- a/sway/input/seatop_move_floating.c +++ b/sway/input/seatop_move_floating.c | |||
@@ -9,20 +9,31 @@ struct seatop_move_floating_event { | |||
9 | double dx, dy; // cursor offset in container | 9 | double dx, dy; // cursor offset in container |
10 | }; | 10 | }; |
11 | 11 | ||
12 | static void finalize_move(struct sway_seat *seat) { | ||
13 | struct seatop_move_floating_event *e = seat->seatop_data; | ||
14 | |||
15 | // We "move" the container to its own location | ||
16 | // so it discovers its output again. | ||
17 | container_floating_move_to(e->con, e->con->x, e->con->y); | ||
18 | |||
19 | seatop_begin_default(seat); | ||
20 | } | ||
21 | |||
12 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, | 22 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, |
13 | struct wlr_input_device *device, uint32_t button, | 23 | struct wlr_input_device *device, uint32_t button, |
14 | enum wlr_button_state state) { | 24 | enum wlr_button_state state) { |
15 | if (seat->cursor->pressed_button_count == 0) { | 25 | if (seat->cursor->pressed_button_count == 0) { |
16 | struct seatop_move_floating_event *e = seat->seatop_data; | 26 | finalize_move(seat); |
17 | |||
18 | // We "move" the container to its own location | ||
19 | // so it discovers its output again. | ||
20 | container_floating_move_to(e->con, e->con->x, e->con->y); | ||
21 | |||
22 | seatop_begin_default(seat); | ||
23 | } | 27 | } |
24 | } | 28 | } |
25 | 29 | ||
30 | static void handle_tablet_tool_tip(struct sway_seat *seat, | ||
31 | struct sway_tablet_tool *tool, uint32_t time_msec, | ||
32 | enum wlr_tablet_tool_tip_state state) { | ||
33 | if (state == WLR_TABLET_TOOL_TIP_UP) { | ||
34 | finalize_move(seat); | ||
35 | } | ||
36 | } | ||
26 | static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec, | 37 | static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec, |
27 | double dx, double dy) { | 38 | double dx, double dy) { |
28 | struct seatop_move_floating_event *e = seat->seatop_data; | 39 | struct seatop_move_floating_event *e = seat->seatop_data; |
@@ -42,6 +53,7 @@ static void handle_unref(struct sway_seat *seat, struct sway_container *con) { | |||
42 | static const struct sway_seatop_impl seatop_impl = { | 53 | static const struct sway_seatop_impl seatop_impl = { |
43 | .button = handle_button, | 54 | .button = handle_button, |
44 | .pointer_motion = handle_pointer_motion, | 55 | .pointer_motion = handle_pointer_motion, |
56 | .tablet_tool_tip = handle_tablet_tool_tip, | ||
45 | .unref = handle_unref, | 57 | .unref = handle_unref, |
46 | }; | 58 | }; |
47 | 59 | ||