Try switching workspace on gesture cancel instead of reset

This commit is contained in:
Erik Reider 2024-01-22 12:21:57 +01:00
parent 8afad34fd5
commit 9e551680db
3 changed files with 8 additions and 21 deletions

View file

@ -206,8 +206,6 @@ void update_workspace_scroll_percent(int dx, int invert);
void snap_workspace_scroll_percent(int dx, int invert);
void reset_workspace_scroll_percent();
struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
#endif

View file

@ -1110,6 +1110,12 @@ static void workspace_scroll_mark_dirty(struct sway_output *output) {
transaction_commit_dirty();
}
static void reset_workspace_scroll_percent(struct sway_output *output) {
output->workspace_scroll_percent = 0;
workspace_scroll_mark_dirty(output);
}
void update_workspace_scroll_percent(int dx, int invert) {
struct sway_seat *seat = input_manager_get_default_seat();
struct sway_workspace *focused_ws = seat_get_focused_workspace(seat);
@ -1180,15 +1186,5 @@ void snap_workspace_scroll_percent(int dx, int invert) {
reset:
// Reset the state
reset_workspace_scroll_percent();
}
void reset_workspace_scroll_percent() {
struct sway_seat *seat = input_manager_get_default_seat();
struct sway_workspace *focused_ws = seat_get_focused_workspace(seat);
struct sway_output *output = focused_ws->output;
output->workspace_scroll_percent = 0;
workspace_scroll_mark_dirty(output);
reset_workspace_scroll_percent(output);
}

View file

@ -1086,14 +1086,7 @@ static void handle_swipe_end(struct sway_seat *seat,
cursor->seat->wlr_seat, event->time_msec, event->cancelled);
return;
}
if (event->cancelled) {
switch (seatop->gestures.type) {
case GESTURE_TYPE_WORKSPACE_SWIPE:
reset_workspace_scroll_percent();
break;
default:
break;
}
if (event->cancelled && seatop->gestures.type != GESTURE_TYPE_WORKSPACE_SWIPE) {
gesture_tracker_cancel(&seatop->gestures);
return;
}