diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-21 10:40:12 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-22 23:10:19 +1000 |
commit | 0c87bff5d1ce686afdc25d37eee4bdd8f08abdd3 (patch) | |
tree | ab1b5be08daccc0e92ebff7497687b252fa5f5dc | |
parent | Remove unnecessary includes (diff) | |
download | sway-0c87bff5d1ce686afdc25d37eee4bdd8f08abdd3.tar.gz sway-0c87bff5d1ce686afdc25d37eee4bdd8f08abdd3.tar.zst sway-0c87bff5d1ce686afdc25d37eee4bdd8f08abdd3.zip |
Replace static handle_end_operation with seat_end_mouse_operation
-rw-r--r-- | include/sway/input/seat.h | 2 | ||||
-rw-r--r-- | sway/input/cursor.c | 17 | ||||
-rw-r--r-- | sway/input/seat.c | 19 | ||||
-rw-r--r-- | sway/tree/container.c | 3 |
4 files changed, 23 insertions, 18 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 35a965ee..cd36ef5a 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -155,4 +155,6 @@ void seat_begin_move(struct sway_seat *seat, struct sway_container *con); | |||
155 | void seat_begin_resize(struct sway_seat *seat, struct sway_container *con, | 155 | void seat_begin_resize(struct sway_seat *seat, struct sway_container *con, |
156 | uint32_t button, enum wlr_edges edge); | 156 | uint32_t button, enum wlr_edges edge); |
157 | 157 | ||
158 | void seat_end_mouse_operation(struct sway_seat *seat); | ||
159 | |||
158 | #endif | 160 | #endif |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 8b9208c6..ec83746e 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -427,21 +427,6 @@ static void handle_cursor_motion_absolute( | |||
427 | transaction_commit_dirty(); | 427 | transaction_commit_dirty(); |
428 | } | 428 | } |
429 | 429 | ||
430 | static void handle_end_operation(struct sway_seat *seat) { | ||
431 | if (seat->operation == OP_MOVE) { | ||
432 | // We "move" the container to its own location so it discovers its | ||
433 | // output again. | ||
434 | struct sway_container *con = seat->op_container; | ||
435 | container_floating_move_to(con, con->x, con->y); | ||
436 | seat->operation = OP_NONE; | ||
437 | seat->op_container = NULL; | ||
438 | } else { | ||
439 | // OP_RESIZE | ||
440 | seat->operation = OP_NONE; | ||
441 | seat->op_container = NULL; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | static void dispatch_cursor_button_floating(struct sway_cursor *cursor, | 430 | static void dispatch_cursor_button_floating(struct sway_cursor *cursor, |
446 | uint32_t time_msec, uint32_t button, enum wlr_button_state state, | 431 | uint32_t time_msec, uint32_t button, enum wlr_button_state state, |
447 | struct wlr_surface *surface, double sx, double sy, | 432 | struct wlr_surface *surface, double sx, double sy, |
@@ -484,7 +469,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
484 | uint32_t time_msec, uint32_t button, enum wlr_button_state state) { | 469 | uint32_t time_msec, uint32_t button, enum wlr_button_state state) { |
485 | if (cursor->seat->operation != OP_NONE && | 470 | if (cursor->seat->operation != OP_NONE && |
486 | button == cursor->seat->op_button && state == WLR_BUTTON_RELEASED) { | 471 | button == cursor->seat->op_button && state == WLR_BUTTON_RELEASED) { |
487 | handle_end_operation(cursor->seat); | 472 | seat_end_mouse_operation(cursor->seat); |
488 | return; | 473 | return; |
489 | } | 474 | } |
490 | if (time_msec == 0) { | 475 | if (time_msec == 0) { |
diff --git a/sway/input/seat.c b/sway/input/seat.c index cc5b2e0f..3a3350e1 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -932,3 +932,22 @@ void seat_begin_resize(struct sway_seat *seat, struct sway_container *con, | |||
932 | seat->op_ref_width = con->width; | 932 | seat->op_ref_width = con->width; |
933 | seat->op_ref_height = con->height; | 933 | seat->op_ref_height = con->height; |
934 | } | 934 | } |
935 | |||
936 | void seat_end_mouse_operation(struct sway_seat *seat) { | ||
937 | switch (seat->operation) { | ||
938 | case OP_MOVE: | ||
939 | { | ||
940 | // We "move" the container to its own location so it discovers its | ||
941 | // output again. | ||
942 | struct sway_container *con = seat->op_container; | ||
943 | container_floating_move_to(con, con->x, con->y); | ||
944 | } | ||
945 | case OP_RESIZE: | ||
946 | // Don't need to do anything here. | ||
947 | break; | ||
948 | case OP_NONE: | ||
949 | break; | ||
950 | } | ||
951 | seat->operation = OP_NONE; | ||
952 | seat->op_container = NULL; | ||
953 | } | ||
diff --git a/sway/tree/container.c b/sway/tree/container.c index ba4af352..42c1d024 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -1114,8 +1114,7 @@ void container_end_mouse_operation(struct sway_container *container) { | |||
1114 | struct sway_seat *seat; | 1114 | struct sway_seat *seat; |
1115 | wl_list_for_each(seat, &input_manager->seats, link) { | 1115 | wl_list_for_each(seat, &input_manager->seats, link) { |
1116 | if (seat->op_container == container) { | 1116 | if (seat->op_container == container) { |
1117 | seat->op_container = NULL; | 1117 | seat_end_mouse_operation(seat); |
1118 | seat->operation = OP_NONE; | ||
1119 | } | 1118 | } |
1120 | } | 1119 | } |
1121 | } | 1120 | } |