Add manual activation area configuration option 66/28066/2
authorScott Murray <scott.murray@konsulko.com>
Tue, 25 Oct 2022 21:25:45 +0000 (17:25 -0400)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Mon, 31 Oct 2022 11:41:10 +0000 (11:41 +0000)
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

(manual cherry-pick of 924473ef016ba8dcfa863861740be2289421313d)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I13885ce7a4d7a1c76761012fe012a2bfbb4474c8

src/compositor.c
src/ivi-compositor.h
src/layout.c

index 7540fe3..d81fc16 100644 (file)
@@ -321,6 +321,23 @@ parse_transform(const char *transform, uint32_t *out)
        return -1;
 }
 
+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)
 {
@@ -344,6 +361,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);
        }
 
index 78d1acd..c9258d1 100644 (file)
@@ -147,6 +147,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;
index 5d24a1f..332b4d7 100644 (file)
@@ -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);