summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-10-11 16:46:26 -0400
committerMarius Vlad <marius.vlad@collabora.com>2022-10-12 14:36:26 +0000
commit924473ef016ba8dcfa863861740be2289421313d (patch)
treed1ffef3d94dc71a6af29526c140888625c6b6296
parent897449688a9c7f934d45acd1eaa09d766d6da67a (diff)
Add manual activation area configuration option
Add a per-output "activation-area" configuration option that can be used to define the activation area for applications that are not using panels. Notes: - A new surface is not created for the given activation area, so apps that are not opaque will show the background. After some thought, this seems like acceptable behavior, but it is possible that I am missing something. - At present setting the activation area explicitly disables use of any panels, this may not need to be the case and some discussion with the AGL community with respect to requirements is likely needed. - It is likely that this feature should be done via a agl-shell protocol call instead of via configuration, but doing so will require some thought as to the interaction with panels and how configuration errors would be communicated back to a client. Bug-AGL: SPEC-4588 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I6cdae659f5f7636dc94121a69666b905abda3be3
-rw-r--r--src/compositor.c21
-rw-r--r--src/ivi-compositor.h4
-rw-r--r--src/layout.c45
3 files changed, 59 insertions, 11 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 564153b..634c468 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -328,6 +328,23 @@ parse_transform(const char *transform, uint32_t *out)
}
static int
+parse_activation_area(const char *geometry, struct ivi_output *output)
+{
+ int n;
+ unsigned width, height, x, y;
+
+ n = sscanf(geometry, "%ux%u+%u,%u", &width, &height, &x, &y);
+ if (n != 4) {
+ return -1;
+ }
+ output->area_activation.width = width;
+ output->area_activation.height = height;
+ output->area_activation.x = x;
+ output->area_activation.y = y;
+ return 0;
+}
+
+static int
configure_output(struct ivi_output *output)
{
struct ivi_compositor *ivi = output->ivi;
@@ -350,6 +367,10 @@ configure_output(struct ivi_output *output)
if (parse_transform(t, &transform) < 0)
weston_log("Invalid transform \"%s\" for output %s\n",
t, output->name);
+ weston_config_section_get_string(section, "activation-area", &t, "");
+ if (parse_activation_area(t, output) < 0)
+ weston_log("Invalid activation-area \"%s\" for output %s\n",
+ t, output->name);
free(t);
}
diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h
index 3cca0a0..bf96fc7 100644
--- a/src/ivi-compositor.h
+++ b/src/ivi-compositor.h
@@ -155,6 +155,10 @@ struct ivi_output {
*/
struct weston_geometry area;
struct weston_geometry area_saved;
+ /*
+ * Potential user-specified non-default activation area
+ */
+ struct weston_geometry area_activation;
struct ivi_surface *active;
struct ivi_surface *previous_active;
diff --git a/src/layout.c b/src/layout.c
index 25221e2..96eb215 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -151,17 +151,40 @@ ivi_panel_init(struct ivi_compositor *ivi, struct ivi_output *output,
void
ivi_layout_init(struct ivi_compositor *ivi, struct ivi_output *output)
{
- ivi_background_init(ivi, output);
+ bool use_default_area = true;
- output->area.x = 0;
- output->area.y = 0;
- output->area.width = output->output->width;
- output->area.height = output->output->height;
+ ivi_background_init(ivi, output);
- ivi_panel_init(ivi, output, output->top);
- ivi_panel_init(ivi, output, output->bottom);
- ivi_panel_init(ivi, output, output->left);
- ivi_panel_init(ivi, output, output->right);
+ if (output->area_activation.width ||
+ output->area_activation.height ||
+ output->area_activation.x ||
+ output->area_activation.y) {
+ /* Sanity check target area is within output bounds */
+ if ((output->area_activation.x + output->area_activation.width) < output->output->width ||
+ (output->area_activation.y + output->area_activation.height) < output->output->height) {
+ weston_log("Using specified area for output %s, ignoring panels\n",
+ output->name);
+ output->area.x = output->area_activation.x;
+ output->area.y = output->area_activation.y;
+ output->area.width = output->area_activation.width;
+ output->area.height = output->area_activation.height;
+ use_default_area = false;
+ } else {
+ weston_log("Invalid activation-area position for output %s, ignoring\n",
+ output->name);
+ }
+ }
+ if (use_default_area) {
+ output->area.x = 0;
+ output->area.y = 0;
+ output->area.width = output->output->width;
+ output->area.height = output->output->height;
+
+ ivi_panel_init(ivi, output, output->top);
+ ivi_panel_init(ivi, output, output->bottom);
+ ivi_panel_init(ivi, output, output->left);
+ ivi_panel_init(ivi, output, output->right);
+ }
weston_compositor_schedule_repaint(ivi->compositor);
@@ -349,8 +372,8 @@ ivi_layout_add_to_hidden_layer(struct ivi_surface *surf,
ivi_output->area.height);
weston_log("Setting app_id %s, role %s, set to maximized (%dx%d)\n",
- app_id, ivi_layout_get_surface_role_name(surf),
- ivi_output->area.width, ivi_output->area.height);
+ app_id, ivi_layout_get_surface_role_name(surf),
+ ivi_output->area.width, ivi_output->area.height);
surf->hidden_layer_output = ivi_output;
weston_view_set_output(ev, ivi_output->output);