diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-08 01:03:44 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-02-09 09:37:10 +0100 |
commit | 50205ade9d7b3d4c014fce5364db329c29acfa86 (patch) | |
tree | 5bb5f51f6fd9caf58be821b534682afa51217c68 /sway/desktop/transaction.c | |
parent | view: Save surface x and y on saved buffers (diff) | |
download | sway-50205ade9d7b3d4c014fce5364db329c29acfa86.tar.gz sway-50205ade9d7b3d4c014fce5364db329c29acfa86.tar.zst sway-50205ade9d7b3d4c014fce5364db329c29acfa86.zip |
transaction: Move centering to view_center_surface
This will allow us to reuse it for centering elsewhere.
Diffstat (limited to 'sway/desktop/transaction.c')
-rw-r--r-- | sway/desktop/transaction.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 2d71ad2b..ead662f9 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -255,18 +255,7 @@ static void apply_container_state(struct sway_container *container, | |||
255 | // the container. This is important for fullscreen views which | 255 | // the container. This is important for fullscreen views which |
256 | // refuse to resize to the size of the output. | 256 | // refuse to resize to the size of the output. |
257 | if (view && view->surface) { | 257 | if (view && view->surface) { |
258 | if (view->geometry.width < container->current.content_width) { | 258 | view_center_surface(view); |
259 | container->surface_x = container->current.content_x + | ||
260 | (container->current.content_width - view->geometry.width) / 2; | ||
261 | } else { | ||
262 | container->surface_x = container->current.content_x; | ||
263 | } | ||
264 | if (view->geometry.height < container->current.content_height) { | ||
265 | container->surface_y = container->current.content_y + | ||
266 | (container->current.content_height - view->geometry.height) / 2; | ||
267 | } else { | ||
268 | container->surface_y = container->current.content_y; | ||
269 | } | ||
270 | } | 259 | } |
271 | 260 | ||
272 | if (!container->node.destroying) { | 261 | if (!container->node.destroying) { |