agl-shell: Add support for defining an activation area 02/28102/1
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 1 Nov 2022 15:42:43 +0000 (17:42 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Tue, 1 Nov 2022 16:25:25 +0000 (18:25 +0200)
This introduces a new request, 'set_activate_region' that hints to the
compositor to use a defined rectangle area, rather than to infer it.

This is a follow-up from commit 924473ef016ba8dcfa863, 'Add manual
activation area configuration option' which brough in the same feature
but by using the ini configuration file.

Bug-AGL: SPEC-4594
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: If9395268e68de6b0d01f04b90822e06603808299

protocol/agl-shell.xml
src/shell.c

index ad5553d..bf5ab02 100644 (file)
@@ -22,7 +22,7 @@
     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     DEALINGS IN THE SOFTWARE.
   </copyright>
-  <interface name="agl_shell" version="3">
+  <interface name="agl_shell" version="4">
     <description summary="user interface for Automotive Grade Linux platform">
       Starting with version 2 of the protocol, the client is required to wait
       for the 'bound_ok' or 'bound_fail' events in order to proceed further.
       <arg name="state" type="uint" enum="app_state"/>
     </event>
 
-
+    <request name="set_activate_region" since="4">
+      <description summary="sets a specific region to activate">
+      A hint for the compositor to use a custom area, rather than
+      inferring the activation area. If any panels are used
+      the compositor computes the activation area by subtracting the
+      panels geometry area. If no panels are used then the entire output
+      is being used. This request changes that as to hint the compositor
+      to use the supplied rectangle and ignore any potential panels
+      that might been set-up previously.
+
+      In order for this request to take effect it will need to happen
+      before the 'ready' request in order for the compositor to make use of it.
+      Note that any 'set_panel' request be will not be honored, if this request
+      has been called.
+
+      The x and y coordinates use the top-left corner as the origin. The
+      rectangle area shouldn't exceed the output area, while an area smaller
+      than the output, would basically result in showing up the background
+      surface.
+      </description>
+      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="x" type="int" summary="x position of rectangle"/>
+      <arg name="y" type="int" summary="y position of rectangle"/>
+      <arg name="width" type="int" summary="width of rectangle"/>
+      <arg name="height" type="int" summary="height of rectangle"/>
+    </request>
   </interface>
 </protocol>
index 96f5c63..032e114 100644 (file)
@@ -1426,12 +1426,33 @@ shell_destroy(struct wl_client *client, struct wl_resource *res)
 {
 }
 
+static void
+shell_set_activate_region(struct wl_client *client, struct wl_resource *res,
+                         struct wl_resource *output, int x, int y,
+                         int width, int height)
+{
+       struct ivi_compositor *ivi = wl_resource_get_user_data(res);
+       struct weston_head *head = weston_head_from_resource(output);
+       struct weston_output *woutput = weston_head_get_output(head);
+       struct ivi_output *ioutput = to_ivi_output(woutput);
+
+       struct weston_geometry area = { .x = x, .y = y,
+                                       .width = width,
+                                       .height = height };
+       if (ivi->shell_client.ready)
+               return;
+
+       ioutput->area_activation = area;
+}
+
+
 static const struct agl_shell_interface agl_shell_implementation = {
-       .destroy = shell_destroy,
        .ready = shell_ready,
        .set_background = shell_set_background,
        .set_panel = shell_set_panel,
        .activate_app = shell_activate_app,
+       .destroy = shell_destroy,
+       .set_activate_region = shell_set_activate_region
 };
 
 static void
@@ -1659,7 +1680,7 @@ int
 ivi_shell_create_global(struct ivi_compositor *ivi)
 {
        ivi->agl_shell = wl_global_create(ivi->compositor->wl_display,
-                                         &agl_shell_interface, 3,
+                                         &agl_shell_interface, 4,
                                          ivi, bind_agl_shell);
        if (!ivi->agl_shell) {
                weston_log("Failed to create wayland global.\n");