diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-18 09:29:18 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-18 09:29:18 +1000 |
commit | 07a897b3b797b99022a9dfffffc0af2ff50aea85 (patch) | |
tree | 21f148c0741dc02e9ef6fea0c43af47b48f36098 | |
parent | Rename mousedown to down and make seat operation a named enum (diff) | |
download | sway-07a897b3b797b99022a9dfffffc0af2ff50aea85.tar.gz sway-07a897b3b797b99022a9dfffffc0af2ff50aea85.tar.zst sway-07a897b3b797b99022a9dfffffc0af2ff50aea85.zip |
Don't send motion if the cursor hasn't moved
Prevents GTK+ comboboxes from immediately closing.
-rw-r--r-- | include/sway/input/seat.h | 1 | ||||
-rw-r--r-- | sway/input/cursor.c | 1 | ||||
-rw-r--r-- | sway/input/seat.c | 5 |
3 files changed, 6 insertions, 1 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index c07db61c..5c404ecd 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -70,6 +70,7 @@ struct sway_seat { | |||
70 | double op_ref_lx, op_ref_ly; // cursor's x/y at start of op | 70 | double op_ref_lx, op_ref_ly; // cursor's x/y at start of op |
71 | double op_ref_width, op_ref_height; // container's size at start of op | 71 | double op_ref_width, op_ref_height; // container's size at start of op |
72 | double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op | 72 | double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op |
73 | bool op_moved; // if the mouse moved during a down op | ||
73 | 74 | ||
74 | uint32_t last_button; | 75 | uint32_t last_button; |
75 | uint32_t last_button_serial; | 76 | uint32_t last_button_serial; |
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 5a2743e3..37fb203d 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -225,6 +225,7 @@ static void handle_down_motion(struct sway_seat *seat, | |||
225 | double sy = seat->op_ref_con_ly + moved_y; | 225 | double sy = seat->op_ref_con_ly + moved_y; |
226 | wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy); | 226 | wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy); |
227 | } | 227 | } |
228 | seat->op_moved = true; | ||
228 | } | 229 | } |
229 | 230 | ||
230 | static void handle_move_motion(struct sway_seat *seat, | 231 | static void handle_move_motion(struct sway_seat *seat, |
diff --git a/sway/input/seat.c b/sway/input/seat.c index cc7c28d8..9d46e760 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -963,6 +963,7 @@ void seat_begin_down(struct sway_seat *seat, struct sway_container *con, | |||
963 | seat->op_ref_ly = seat->cursor->cursor->y; | 963 | seat->op_ref_ly = seat->cursor->cursor->y; |
964 | seat->op_ref_con_lx = sx; | 964 | seat->op_ref_con_lx = sx; |
965 | seat->op_ref_con_ly = sy; | 965 | seat->op_ref_con_ly = sy; |
966 | seat->op_moved = false; | ||
966 | } | 967 | } |
967 | 968 | ||
968 | void seat_begin_move(struct sway_seat *seat, struct sway_container *con, | 969 | void seat_begin_move(struct sway_seat *seat, struct sway_container *con, |
@@ -1034,7 +1035,9 @@ void seat_end_mouse_operation(struct sway_seat *seat) { | |||
1034 | // during the operation. | 1035 | // during the operation. |
1035 | seat->cursor->previous.x = seat->op_ref_lx; | 1036 | seat->cursor->previous.x = seat->op_ref_lx; |
1036 | seat->cursor->previous.y = seat->op_ref_ly; | 1037 | seat->cursor->previous.y = seat->op_ref_ly; |
1037 | cursor_send_pointer_motion(seat->cursor, 0, true); | 1038 | if (seat->op_moved) { |
1039 | cursor_send_pointer_motion(seat->cursor, 0, true); | ||
1040 | } | ||
1038 | } else { | 1041 | } else { |
1039 | cursor_set_image(seat->cursor, "left_ptr", NULL); | 1042 | cursor_set_image(seat->cursor, "left_ptr", NULL); |
1040 | } | 1043 | } |