diff options
Diffstat (limited to 'sway/input/seatop_resize_tiling.c')
-rw-r--r-- | sway/input/seatop_resize_tiling.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c index db32065c..6b705823 100644 --- a/sway/input/seatop_resize_tiling.c +++ b/sway/input/seatop_resize_tiling.c | |||
@@ -19,7 +19,16 @@ struct seatop_resize_tiling_event { | |||
19 | double v_con_orig_height; // height of the vertical ancestor at start | 19 | double v_con_orig_height; // height of the vertical ancestor at start |
20 | }; | 20 | }; |
21 | 21 | ||
22 | static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { | 22 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, |
23 | struct wlr_input_device *device, uint32_t button, | ||
24 | enum wlr_button_state state) { | ||
25 | if (seat->cursor->pressed_button_count == 0) { | ||
26 | seatop_begin_default(seat); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | static void handle_motion(struct sway_seat *seat, uint32_t time_msec, | ||
31 | double dx, double dy) { | ||
23 | struct seatop_resize_tiling_event *e = seat->seatop_data; | 32 | struct seatop_resize_tiling_event *e = seat->seatop_data; |
24 | int amount_x = 0; | 33 | int amount_x = 0; |
25 | int amount_y = 0; | 34 | int amount_y = 0; |
@@ -49,31 +58,22 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { | |||
49 | } | 58 | } |
50 | } | 59 | } |
51 | 60 | ||
52 | static void handle_finish(struct sway_seat *seat, uint32_t time_msec) { | ||
53 | cursor_set_image(seat->cursor, "left_ptr", NULL); | ||
54 | } | ||
55 | |||
56 | static void handle_abort(struct sway_seat *seat) { | ||
57 | cursor_set_image(seat->cursor, "left_ptr", NULL); | ||
58 | } | ||
59 | |||
60 | static void handle_unref(struct sway_seat *seat, struct sway_container *con) { | 61 | static void handle_unref(struct sway_seat *seat, struct sway_container *con) { |
61 | struct seatop_resize_tiling_event *e = seat->seatop_data; | 62 | struct seatop_resize_tiling_event *e = seat->seatop_data; |
62 | if (e->con == con) { | 63 | if (e->con == con) { |
63 | seatop_abort(seat); | 64 | seatop_begin_default(seat); |
64 | } | 65 | } |
65 | } | 66 | } |
66 | 67 | ||
67 | static const struct sway_seatop_impl seatop_impl = { | 68 | static const struct sway_seatop_impl seatop_impl = { |
69 | .button = handle_button, | ||
68 | .motion = handle_motion, | 70 | .motion = handle_motion, |
69 | .finish = handle_finish, | ||
70 | .abort = handle_abort, | ||
71 | .unref = handle_unref, | 71 | .unref = handle_unref, |
72 | }; | 72 | }; |
73 | 73 | ||
74 | void seatop_begin_resize_tiling(struct sway_seat *seat, | 74 | void seatop_begin_resize_tiling(struct sway_seat *seat, |
75 | struct sway_container *con, uint32_t button, enum wlr_edges edge) { | 75 | struct sway_container *con, enum wlr_edges edge) { |
76 | seatop_abort(seat); | 76 | seatop_end(seat); |
77 | 77 | ||
78 | struct seatop_resize_tiling_event *e = | 78 | struct seatop_resize_tiling_event *e = |
79 | calloc(1, sizeof(struct seatop_resize_tiling_event)); | 79 | calloc(1, sizeof(struct seatop_resize_tiling_event)); |
@@ -105,5 +105,4 @@ void seatop_begin_resize_tiling(struct sway_seat *seat, | |||
105 | 105 | ||
106 | seat->seatop_impl = &seatop_impl; | 106 | seat->seatop_impl = &seatop_impl; |
107 | seat->seatop_data = e; | 107 | seat->seatop_data = e; |
108 | seat->seatop_button = button; | ||
109 | } | 108 | } |