summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Ribeiro <leandrohr@riseup.net>2020-01-24 18:02:27 -0300
committerDaniel Stone <daniels@collabora.com>2020-08-26 14:10:50 +0000
commitb68454e893d4ffbe7a0789983e787a4f31eeaeef (patch)
treeb6f2dde4c64125bece8d077b4fb61fb38f04d66b
parent0c59e92f0c848214100c12f1268a1287d6bf22b2 (diff)
downloadweston-b68454e893d4ffbe7a0789983e787a4f31eeaeef.tar.gz
exposay: do not account panel size to compute exposay area
Commit "desktop-shell: make get_output_work_area() global" allowed the usage of get_output_work_area() in exposay. This is necessary to avoid overlapping the panel when rendering exposay's surfaces. Use get_output_work_area() to not take into account the panel size, instead of considering that the whole screen is available to render exposay's surfaces. Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
-rw-r--r--desktop-shell/exposay.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index b1a8d347..7594301a 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -218,6 +218,7 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
struct exposay_output *eoutput = &shell_output->eoutput;
struct weston_view *view;
struct exposay_surface *esurface, *highlight = NULL;
+ pixman_rectangle32_t exposay_area;
int w, h;
int pad;
int i;
@@ -241,6 +242,10 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
return EXPOSAY_LAYOUT_OVERVIEW;
}
+ /* Get exposay area and position, taking into account
+ * the shell panel position and size */
+ get_output_work_area(shell, output, &exposay_area);
+
/* Lay the grid out as square as possible, losing surfaces from the
* bottom row if required. Start with fixed padding of a 10% margin
* around the outside and 80px internal padding between surfaces, and
@@ -258,23 +263,23 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
eoutput->grid_size++;
last_row_removed = pow(eoutput->grid_size, 2) - eoutput->num_surfaces;
- eoutput->hpadding_outer = (output->width / 10);
- eoutput->vpadding_outer = (output->height / 10);
+ eoutput->hpadding_outer = (exposay_area.width / 10);
+ eoutput->vpadding_outer = (exposay_area.height / 10);
eoutput->padding_inner = 80;
- w = output->width - (eoutput->hpadding_outer * 2);
+ w = exposay_area.width - (eoutput->hpadding_outer * 2);
w -= eoutput->padding_inner * (eoutput->grid_size - 1);
w /= eoutput->grid_size;
- h = output->height - (eoutput->vpadding_outer * 2);
+ h = exposay_area.height - (eoutput->vpadding_outer * 2);
h -= eoutput->padding_inner * (eoutput->grid_size - 1);
h /= eoutput->grid_size;
eoutput->surface_size = (w < h) ? w : h;
- if (eoutput->surface_size > (output->width / 2))
- eoutput->surface_size = output->width / 2;
- if (eoutput->surface_size > (output->height / 2))
- eoutput->surface_size = output->height / 2;
+ if ((uint32_t)eoutput->surface_size > (exposay_area.width / 2))
+ eoutput->surface_size = exposay_area.width / 2;
+ if ((uint32_t)eoutput->surface_size > (exposay_area.height / 2))
+ eoutput->surface_size = exposay_area.height / 2;
pad = eoutput->surface_size + eoutput->padding_inner;
@@ -301,9 +306,9 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
esurface->row = i / eoutput->grid_size;
esurface->column = i % eoutput->grid_size;
- esurface->x = output->x + eoutput->hpadding_outer;
+ esurface->x = exposay_area.x + eoutput->hpadding_outer;
esurface->x += pad * esurface->column;
- esurface->y = output->y + eoutput->vpadding_outer;
+ esurface->y = exposay_area.y + eoutput->vpadding_outer;
esurface->y += pad * esurface->row;
if (esurface->row == eoutput->grid_size - 1)