Skip to content

Commit

Permalink
- fix windowmove with relative movements
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed May 30, 2011
1 parent 83e6570 commit c246171
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cmd_windowmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,27 @@ static int _windowmove(context_t *context, struct windowmove *windowmove) {
}
}

int target_x = windowmove->x;
int target_y = windowmove->y;


if (windowmove->flags & WINDOWMOVE_RELATIVE) {
windowmove->x += orig_win_x;
windowmove->y += orig_win_y;
target_x = orig_win_x + windowmove->x;
target_y = orig_win_y + windowmove->y;
}

if (windowmove->flags & WINDOWMOVE_X_CURRENT) {
windowmove->x = orig_win_x;
target_x = orig_win_x;
xdotool_debug(context, "Using %d for x\n", windowmove->x);
}

if (windowmove->flags & WINDOWMOVE_Y_CURRENT) {
windowmove->y = orig_win_y;
target_y = orig_win_y;
xdotool_debug(context, "Using %d for y\n", windowmove->y);
}


ret = xdo_window_move(context->xdo, windowmove->window,
windowmove->x, windowmove->y);
ret = xdo_window_move(context->xdo, windowmove->window, target_x, target_y);
if (ret) {
fprintf(stderr,
"xdo_window_move reported an error while moving window %ld\n",
Expand Down

0 comments on commit c246171

Please sign in to comment.