summaryrefslogtreecommitdiffstats
path: root/sway/handlers.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c19
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
305 !pointer_state.left.held && !pointer_state.right.held && !pointer_state.scroll.held) { 305 !pointer_state.left.held && !pointer_state.right.held && !pointer_state.scroll.held) {
306 306
307 swayc_t *output = swayc_active_output(), *adjacent = NULL; 307 swayc_t *output = swayc_active_output(), *adjacent = NULL;
308 struct wlc_point abs_pos = *origin;
309 abs_pos.x += output->x;
310 abs_pos.y += output->y;
308 if (origin->x == 0) { // Left edge 311 if (origin->x == 0) { // Left edge
309 if ((adjacent = swayc_adjacent_output(output, MOVE_LEFT))) { 312 if ((adjacent = swayc_adjacent_output(output, MOVE_LEFT, &abs_pos, false))) {
310 if (workspace_switch(swayc_active_workspace_for(adjacent))) { 313 if (workspace_switch(swayc_active_workspace_for(adjacent))) {
311 new_origin.x = adjacent->width; 314 new_origin.x = adjacent->width;
315 // adjust for differently aligned outputs (well, this is
316 // only correct when the two outputs have the same
317 // resolution or the same dpi I guess, it should take
318 // physical attributes into account)
319 new_origin.y += (output->y - adjacent->y);
312 } 320 }
313 } 321 }
314 } else if ((double)origin->x == output->width) { // Right edge 322 } else if ((double)origin->x == output->width) { // Right edge
315 if ((adjacent = swayc_adjacent_output(output, MOVE_RIGHT))) { 323 if ((adjacent = swayc_adjacent_output(output, MOVE_RIGHT, &abs_pos, false))) {
316 if (workspace_switch(swayc_active_workspace_for(adjacent))) { 324 if (workspace_switch(swayc_active_workspace_for(adjacent))) {
317 new_origin.x = 0; 325 new_origin.x = 0;
326 new_origin.y += (output->y - adjacent->y);
318 } 327 }
319 } 328 }
320 } else if (origin->y == 0) { // Top edge 329 } else if (origin->y == 0) { // Top edge
321 if ((adjacent = swayc_adjacent_output(output, MOVE_UP))) { 330 if ((adjacent = swayc_adjacent_output(output, MOVE_UP, &abs_pos, false))) {
322 if (workspace_switch(swayc_active_workspace_for(adjacent))) { 331 if (workspace_switch(swayc_active_workspace_for(adjacent))) {
323 new_origin.y = adjacent->height; 332 new_origin.y = adjacent->height;
333 new_origin.x += (output->x - adjacent->x);
324 } 334 }
325 } 335 }
326 } else if ((double)origin->y == output->height) { // Bottom edge 336 } else if ((double)origin->y == output->height) { // Bottom edge
327 if ((adjacent = swayc_adjacent_output(output, MOVE_DOWN))) { 337 if ((adjacent = swayc_adjacent_output(output, MOVE_DOWN, &abs_pos, false))) {
328 if (workspace_switch(swayc_active_workspace_for(adjacent))) { 338 if (workspace_switch(swayc_active_workspace_for(adjacent))) {
329 new_origin.y = 0; 339 new_origin.y = 0;
340 new_origin.x += (output->x - adjacent->x);
330 } 341 }
331 } 342 }
332 } 343 }