Don't send motion if the cursor hasn't moved

Prevents GTK+ comboboxes from immediately closing.
master
Ryan Dwyer 6 years ago
parent b637b61a7a
commit 07a897b3b7

@ -70,6 +70,7 @@ struct sway_seat {
double op_ref_lx, op_ref_ly; // cursor's x/y at start of op double op_ref_lx, op_ref_ly; // cursor's x/y at start of op
double op_ref_width, op_ref_height; // container's size at start of op double op_ref_width, op_ref_height; // container's size at start of op
double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op double op_ref_con_lx, op_ref_con_ly; // container's x/y at start of op
bool op_moved; // if the mouse moved during a down op
uint32_t last_button; uint32_t last_button;
uint32_t last_button_serial; uint32_t last_button_serial;

@ -225,6 +225,7 @@ static void handle_down_motion(struct sway_seat *seat,
double sy = seat->op_ref_con_ly + moved_y; double sy = seat->op_ref_con_ly + moved_y;
wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy); wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy);
} }
seat->op_moved = true;
} }
static void handle_move_motion(struct sway_seat *seat, static void handle_move_motion(struct sway_seat *seat,

@ -963,6 +963,7 @@ void seat_begin_down(struct sway_seat *seat, struct sway_container *con,
seat->op_ref_ly = seat->cursor->cursor->y; seat->op_ref_ly = seat->cursor->cursor->y;
seat->op_ref_con_lx = sx; seat->op_ref_con_lx = sx;
seat->op_ref_con_ly = sy; seat->op_ref_con_ly = sy;
seat->op_moved = false;
} }
void seat_begin_move(struct sway_seat *seat, struct sway_container *con, 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) {
// during the operation. // during the operation.
seat->cursor->previous.x = seat->op_ref_lx; seat->cursor->previous.x = seat->op_ref_lx;
seat->cursor->previous.y = seat->op_ref_ly; seat->cursor->previous.y = seat->op_ref_ly;
cursor_send_pointer_motion(seat->cursor, 0, true); if (seat->op_moved) {
cursor_send_pointer_motion(seat->cursor, 0, true);
}
} else { } else {
cursor_set_image(seat->cursor, "left_ptr", NULL); cursor_set_image(seat->cursor, "left_ptr", NULL);
} }

Loading…
Cancel
Save