diff options
-rw-r--r-- | sway/handlers.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 351d0a0f..6d3f48aa 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -353,6 +353,7 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier } static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_origin *origin) { + struct wlc_origin new_origin = *origin; // Switch to adjacent output if touching output edge. // // Since this doesn't currently support moving windows between outputs we @@ -372,6 +373,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct if (c->y == output->y && c->x + c->width == output->x) { sway_log(L_DEBUG, "%s is right of %s", output->name, c->name); workspace_switch(c); + new_origin.x = c->width; } } } else if ((double)origin->x == output->width) { // Right edge @@ -383,6 +385,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct if (c->y == output->y && output->x + output->width == c->x) { sway_log(L_DEBUG, "%s is left of %s", output->name, c->name); workspace_switch(c); + new_origin.x = 0; } } } @@ -395,6 +398,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct if (output->x == c->x && c->y + c->height == output->y) { sway_log(L_DEBUG, "%s is below %s", output->name, c->name); workspace_switch(c); + new_origin.y = 0; } } } else if ((double)origin->y == output->height) { // Bottom edge @@ -406,6 +410,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct if (output->x == c->x && output->y + output->height == c->y) { sway_log(L_DEBUG, "%s is above %s", output->name, c->name); workspace_switch(c); + new_origin.y = c->height; } } } @@ -431,6 +436,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct set_focused_container(pointer_state.view); } } + wlc_pointer_set_origin(new_origin); return EVENT_PASSTHROUGH; } |