From 77d94d831dfcdb4e173cd5253d94ec724d576e77 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Tue, 1 Nov 2022 17:42:43 +0200 Subject: agl-shell: Add support for defining an activation area 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 Change-Id: If9395268e68de6b0d01f04b90822e06603808299 --- protocol/agl-shell.xml | 29 +++++++++++++++++++++++++++-- src/shell.c | 25 +++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/protocol/agl-shell.xml b/protocol/agl-shell.xml index ad5553d..bf5ab02 100644 --- a/protocol/agl-shell.xml +++ b/protocol/agl-shell.xml @@ -22,7 +22,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + 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. @@ -174,6 +174,31 @@ - + + + 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. + + + + + + + diff --git a/src/shell.c b/src/shell.c index 96f5c63..032e114 100644 --- a/src/shell.c +++ b/src/shell.c @@ -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"); -- cgit 1.2.3-korg