diff options
author | Drew DeVault <[email protected]> | 2015-11-16 15:57:02 -0500 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2015-11-16 15:57:02 -0500 |
commit | 6850174049b9b8ffc00aac7051d82b3489bcc948 (patch) | |
tree | bdac5630c32099785a6eade4dfa8ceb04a3c11dd /sway/handlers.c | |
parent | 95c65ee33ea05963e334555311414e0d834de4b7 (diff) | |
parent | 236f26f62e56cef8278d88f6111720b738d4a85f (diff) |
Merge pull request #233 from sce/multiple_adjacent_outputs
output: Support multiple adjacent outputs.
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index cadfce5c..3f3c1bdd 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -305,28 +305,39 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct !pointer_state.left.held && !pointer_state.right.held && !pointer_state.scroll.held) { swayc_t *output = swayc_active_output(), *adjacent = NULL; + struct wlc_point abs_pos = *origin; + abs_pos.x += output->x; + abs_pos.y += output->y; if (origin->x == 0) { // Left edge - if ((adjacent = swayc_adjacent_output(output, MOVE_LEFT))) { + if ((adjacent = swayc_adjacent_output(output, MOVE_LEFT, &abs_pos, false))) { if (workspace_switch(swayc_active_workspace_for(adjacent))) { new_origin.x = adjacent->width; + // adjust for differently aligned outputs (well, this is + // only correct when the two outputs have the same + // resolution or the same dpi I guess, it should take + // physical attributes into account) + new_origin.y += (output->y - adjacent->y); } } } else if ((double)origin->x == output->width) { // Right edge - if ((adjacent = swayc_adjacent_output(output, MOVE_RIGHT))) { + if ((adjacent = swayc_adjacent_output(output, MOVE_RIGHT, &abs_pos, false))) { if (workspace_switch(swayc_active_workspace_for(adjacent))) { new_origin.x = 0; + new_origin.y += (output->y - adjacent->y); } } } else if (origin->y == 0) { // Top edge - if ((adjacent = swayc_adjacent_output(output, MOVE_UP))) { + if ((adjacent = swayc_adjacent_output(output, MOVE_UP, &abs_pos, false))) { if (workspace_switch(swayc_active_workspace_for(adjacent))) { new_origin.y = adjacent->height; + new_origin.x += (output->x - adjacent->x); } } } else if ((double)origin->y == output->height) { // Bottom edge - if ((adjacent = swayc_adjacent_output(output, MOVE_DOWN))) { + if ((adjacent = swayc_adjacent_output(output, MOVE_DOWN, &abs_pos, false))) { if (workspace_switch(swayc_active_workspace_for(adjacent))) { new_origin.y = 0; + new_origin.x += (output->x - adjacent->x); } } } |