Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dragging between screens on same output #135

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ void check_screen_switch(const mouse_values_t *values, device_t *state) {

int direction = jump_left ? LEFT : RIGHT;

/* No switching allowed if explicitly disabled or mouse button is held */
if (state->switch_lock || state->mouse_buttons)
/* No switching allowed if explicitly disabled */
if (state->switch_lock)
return;

/* No jump condition met == nothing to do, return */
Expand All @@ -194,9 +194,12 @@ void check_screen_switch(const mouse_values_t *values, device_t *state) {

/* We want to jump in the direction of the other computer */
if (output->pos != direction) {
if (output->screen_index == 1) /* We are at the border -> switch outputs */
switch_screen(state, output, new_x, state->active_output, 1 - state->active_output, direction);

if (output->screen_index == 1) { /* We are at the border -> switch outputs */
if (state->mouse_buttons) /* If mouse button is held, switching output is disallowed */
return;
else /* But we can switch screens on the same output if button is held */
switch_screen(state, output, new_x, state->active_output, 1 - state->active_output, direction);
}
/* If here, this output has multiple desktops and we are not on the main one */
else
switch_desktop(state, output, output->screen_index - 1, direction);
Expand Down