mirror of
https://github.com/swaywm/sway.git
synced 2026-04-17 06:46:32 -04:00
Merge e4f944275c into 81246fc6dc
This commit is contained in:
commit
616426e900
2 changed files with 28 additions and 2 deletions
|
|
@ -777,9 +777,10 @@ static struct cmd_results *cmd_move_to_position_pointer(
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char expected_position_syntax[] =
|
static const char expected_position_syntax[] =
|
||||||
"Expected 'move [absolute] position <x> [px] <y> [px]' or "
|
"Expected 'move [absolute] position <x> [px|ppt] <y> [px|ppt]' or "
|
||||||
"'move [absolute] position center' or "
|
"'move [absolute] position center' or "
|
||||||
"'move position cursor|mouse|pointer'";
|
"'move position cursor|mouse|pointer' "
|
||||||
|
"(negative coordinates are relative to the workspace/screen bottom-right corner)";
|
||||||
|
|
||||||
static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
|
static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
|
||||||
struct sway_container *container = config->handler_context.container;
|
struct sway_container *container = config->handler_context.container;
|
||||||
|
|
@ -910,6 +911,26 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
|
||||||
sway_assert(false, "invalid y unit");
|
sway_assert(false, "invalid y unit");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Negative coordinates are measured from the bottom-right corner of the
|
||||||
|
// screen/workspace rather than the top-left corner, so that e.g.
|
||||||
|
// "move position -10px -10px" places the window's bottom-right corner
|
||||||
|
// 10px from the screen/workspace bottom-right corner.
|
||||||
|
if (lx.amount < 0) {
|
||||||
|
if (absolute) {
|
||||||
|
lx.amount = root->x + root->width + lx.amount
|
||||||
|
- container->pending.width;
|
||||||
|
} else {
|
||||||
|
lx.amount = ws->width + lx.amount - container->pending.width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ly.amount < 0) {
|
||||||
|
if (absolute) {
|
||||||
|
ly.amount = root->y + root->height + ly.amount
|
||||||
|
- container->pending.height;
|
||||||
|
} else {
|
||||||
|
ly.amount = ws->height + ly.amount - container->pending.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!absolute) {
|
if (!absolute) {
|
||||||
lx.amount += ws->x;
|
lx.amount += ws->x;
|
||||||
ly.amount += ws->y;
|
ly.amount += ws->y;
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,11 @@ set|plus|minus|toggle <amount>
|
||||||
The position can be specified in pixels or percentage points, omitting
|
The position can be specified in pixels or percentage points, omitting
|
||||||
the unit defaults to pixels. If _absolute_ is used, the position is
|
the unit defaults to pixels. If _absolute_ is used, the position is
|
||||||
relative to all outputs. _absolute_ can not be used with percentage points.
|
relative to all outputs. _absolute_ can not be used with percentage points.
|
||||||
|
Negative coordinates are measured from the bottom-right corner of the
|
||||||
|
workspace (or all outputs when _absolute_ is used): a negative value places
|
||||||
|
the container so that its bottom-right corner is that many pixels (or
|
||||||
|
percentage points of the workspace dimension) from the workspace bottom-right
|
||||||
|
corner.
|
||||||
|
|
||||||
*move* [absolute] position center
|
*move* [absolute] position center
|
||||||
Moves the focused container to be centered on the workspace. If _absolute_
|
Moves the focused container to be centered on the workspace. If _absolute_
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue