mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 09:51:29 +00:00
transaction: Account for full size when centering content
The centering logic needs to take borders, titlebars and CSDs into account. Instead of using the main surface geometry, use the container and view geometry, which account for this.
This commit is contained in:
parent
4edd429053
commit
645cf76f8a
|
@ -255,20 +255,20 @@ static void apply_container_state(struct sway_container *container,
|
||||||
// the container. This is important for fullscreen views which
|
// the container. This is important for fullscreen views which
|
||||||
// refuse to resize to the size of the output.
|
// refuse to resize to the size of the output.
|
||||||
if (view && view->surface) {
|
if (view && view->surface) {
|
||||||
if (view->surface->current.width < container->width) {
|
if (view->geometry.width < container->current.content_width) {
|
||||||
container->surface_x = container->content_x +
|
container->surface_x = container->current.content_x +
|
||||||
(container->content_width - view->surface->current.width) / 2;
|
(container->current.content_width - view->geometry.width) / 2;
|
||||||
} else {
|
} else {
|
||||||
container->surface_x = container->content_x;
|
container->surface_x = container->current.content_x;
|
||||||
}
|
}
|
||||||
if (view->surface->current.height < container->height) {
|
if (view->geometry.height < container->current.content_height) {
|
||||||
container->surface_y = container->content_y +
|
container->surface_y = container->current.content_y +
|
||||||
(container->content_height - view->surface->current.height) / 2;
|
(container->current.content_height - view->geometry.height) / 2;
|
||||||
} else {
|
} else {
|
||||||
container->surface_y = container->content_y;
|
container->surface_y = container->current.content_y;
|
||||||
}
|
}
|
||||||
container->surface_width = view->surface->current.width;
|
container->surface_width = container->current.content_width;
|
||||||
container->surface_height = view->surface->current.height;
|
container->surface_height = container->current.content_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!container->node.destroying) {
|
if (!container->node.destroying) {
|
||||||
|
|
Loading…
Reference in a new issue