exposay: centralize exposay's surfaces in their own square
authorLeandro Ribeiro <leandrohr@riseup.net>
Sat, 25 Jan 2020 17:40:49 +0000 (14:40 -0300)
committerDaniel Stone <daniels@collabora.com>
Wed, 26 Aug 2020 14:10:50 +0000 (14:10 +0000)
Commit "exposay: add margins to centralize exposay" has centralized
the whole exposay, but that's not enough. The internal surfaces of
exposay are not centralized.

Each internal surface of exposay is a square, but most of the windows
are rectangular. Add margin to centralize exposay's surfaces in their
own square.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
desktop-shell/exposay.c

index 7836dc032d24697bcefbbdb05684998d7611a326..09bc3f26b31c9a78ed406a065d93a40556ee056c 100644 (file)
@@ -348,6 +348,13 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
                esurface->width = view->surface->width * esurface->scale;
                esurface->height = view->surface->height * esurface->scale;
 
+               /* Surfaces are usually rectangular, but their exposay surfaces
+                * are square. centralize them in their own square */
+               if (esurface->width > esurface->height)
+                       esurface->y += (esurface->width - esurface->height) / 2;
+               else
+                       esurface->x += (esurface->height - esurface->width) / 2;
+
                if (shell->exposay.focus_current == esurface->view)
                        highlight = esurface;