Remove 'method' from cmd_move_window_to_position
For command: move window to [absolute] position X px Y px if the optional keyword 'absolute' is provided the end result is the same even though it is implemented differently. Only difference is that with absolute the floating window can move completely outside of any output. This commit removes the 'method' argument and only keeps the sane implementation.
This commit is contained in:
parent
670dfa0bba
commit
174dc389ff
|
@ -2030,10 +2030,13 @@ Use the +move+ command to move a container.
|
||||||
# defaults to 10 pixels.
|
# defaults to 10 pixels.
|
||||||
move <left|right|down|up> [<px> px]
|
move <left|right|down|up> [<px> px]
|
||||||
|
|
||||||
# Moves the container either to a specific location
|
# Moves the container to the specified pos_x and pos_y
|
||||||
# or to the center of the screen. If 'absolute' is
|
# coordinates on the screen.
|
||||||
# used, it is moved to the center of all outputs.
|
move position <pos_x> [px] <pos_y> [px]
|
||||||
move [absolute] position <pos_x> [px] <pos_y> [px]
|
|
||||||
|
# Moves the container to the center of the screen.
|
||||||
|
# If 'absolute' is used, it is moved to the center of
|
||||||
|
# all outputs.
|
||||||
move [absolute] position center
|
move [absolute] position center
|
||||||
|
|
||||||
# Moves the container to the current position of the
|
# Moves the container to the current position of the
|
||||||
|
|
|
@ -264,7 +264,7 @@ void cmd_focus_output(I3_CMD, const char *name);
|
||||||
* Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px]
|
* Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px]
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cmd_move_window_to_position(I3_CMD, const char *method, long x, long y);
|
void cmd_move_window_to_position(I3_CMD, long x, long y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of 'move [window|container] [to] [absolute] position center
|
* Implementation of 'move [window|container] [to] [absolute] position center
|
||||||
|
|
|
@ -396,7 +396,7 @@ state MOVE_TO_POSITION_X:
|
||||||
|
|
||||||
state MOVE_TO_POSITION_Y:
|
state MOVE_TO_POSITION_Y:
|
||||||
'px', end
|
'px', end
|
||||||
-> call cmd_move_window_to_position($method, &coord_x, &coord_y)
|
-> call cmd_move_window_to_position(&coord_x, &coord_y)
|
||||||
|
|
||||||
# mode <string>
|
# mode <string>
|
||||||
state MODE:
|
state MODE:
|
||||||
|
|
|
@ -1694,7 +1694,7 @@ void cmd_focus_output(I3_CMD, const char *name) {
|
||||||
* Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px]
|
* Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px]
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cmd_move_window_to_position(I3_CMD, const char *method, long x, long y) {
|
void cmd_move_window_to_position(I3_CMD, long x, long y) {
|
||||||
bool has_error = false;
|
bool has_error = false;
|
||||||
|
|
||||||
owindow *current;
|
owindow *current;
|
||||||
|
@ -1712,24 +1712,13 @@ void cmd_move_window_to_position(I3_CMD, const char *method, long x, long y) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(method, "absolute") == 0) {
|
Rect newrect = current->con->parent->rect;
|
||||||
current->con->parent->rect.x = x;
|
|
||||||
current->con->parent->rect.y = y;
|
|
||||||
|
|
||||||
DLOG("moving to absolute position %ld %ld\n", x, y);
|
DLOG("moving to position %ld %ld\n", x, y);
|
||||||
floating_maybe_reassign_ws(current->con->parent);
|
newrect.x = x;
|
||||||
cmd_output->needs_tree_render = true;
|
newrect.y = y;
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(method, "position") == 0) {
|
floating_reposition(current->con->parent, newrect);
|
||||||
Rect newrect = current->con->parent->rect;
|
|
||||||
|
|
||||||
DLOG("moving to position %ld %ld\n", x, y);
|
|
||||||
newrect.x = x;
|
|
||||||
newrect.y = y;
|
|
||||||
|
|
||||||
floating_reposition(current->con->parent, newrect);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: default reply for now, make this a better reply
|
// XXX: default reply for now, make this a better reply
|
||||||
|
|
Loading…
Reference in New Issue