Skip to content

Commit

Permalink
#142 smart swap/warp for window drag actions
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Oct 11, 2019
1 parent 41dcd5b commit b4fef45
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,10 @@ static EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP)
* */

if (a_node && b_node) {
if (a_node->parent == b_node->parent) {
goto do_swap;
}

CGRect frame = window_ax_frame(window);
CGPoint point_in_window = {
.x = point.x - frame.origin.x,
Expand Down Expand Up @@ -1010,6 +1014,7 @@ static EVENT_CALLBACK(EVENT_HANDLER_MOUSE_UP)
left_triangle[2].y = 0.0f;

if (CGRectContainsPoint(window_center, point_in_window)) {
do_swap:
a_node->window_id = window->id;
a_node->zoom = NULL;
b_node->window_id = g_mouse_state.window->id;
Expand Down

0 comments on commit b4fef45

Please sign in to comment.