summaryrefslogtreecommitdiffstats
path: root/src/shell.c
AgeCommit message (Collapse)AuthorFilesLines
2023-06-13shell: Don't reset the activation area alwaysoctopusMarius Vlad1-2/+4
Rather than doing that always, be more selective, and perform it if we had already an application active. Bug-AGL: SPEC-4829 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I707f92d1cc1f820af493bae9daa5a948aa452ad8
2023-03-01shell: Check for a valid ivi_surfaceMarius Vlad1-1/+2
A hot-plug/re-plug event means we remove the black curtain with it the ivi_surface that hangs out of it, so verify it before assuming there's one installed. Bug-AGL: SPEC-4705 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Iad53ae34b4e15b5962cf984978a65c344aac9200 (cherry picked from commit ee50083d93869aaa581a092c522efe08252fae55)
2023-03-01shell: Check for invalid outputs passed on when activatingMarius Vlad1-4/+14
Connector hot-plugging would generate new wl_output object, which the client might re-use so rather than blindly trusting the client, make sure that the output we're getting is really one suitable. This should avoid getting an incorrect output upon re-plugging in a connector. Bug-AGL: SPEC-4705 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I732283fc16841e0e57ddbec5d8bd2333d5028433 (cherry picked from commit 02fcb317161c08bcf02093a74abe18d4a4392335)
2023-01-17shell: Reset the area activationMarius Vlad1-0/+3
Re-starting the shell client wouldn't reset the activation area, which might be rather confusing, so better be re-initialize it as to be able to switch in-between various configurations. Bug-AGL: SPEC-4674 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ib964ebed2c189f82092ffcf4d54dee2cf22093e1
2023-01-05shell: Verify agl-shell version for bound_ok/bound_failMarius Vlad1-7/+18
Some additional checks to avoid cases where agl-shell is still using the version 1 but we're checking against at least version 2 (where we introduced some additional events). Part of the compat series. Bug-AGL: SPEC-4667 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I4f5d34fd8b9fe6cf6b8097948afebee550f5345d
2023-01-05shell: Add fallback agl-shell version 1Marius Vlad1-0/+5
Turns out I made a mistake making all clients with version 1 not able to bind to agl-shell anymore. Rather than doing that still allow older clients to bind to agl-shell. Bug-AGL: SPEC-4667 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I61224f39dd8b0d96b36695f536eed8e701130877
2022-12-14src: Further hotplug connector fixesMarius Vlad1-4/+7
Some further checks for the black curtain not being present always when perform hot-plugging operations. Bug-AGL: SPEC-4625 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reported-by: Detlev Casanova <detlev.casanova@collabora.com> Change-Id: Ia7c05e5b90b9e8260f661a8115a93b0d246b9d98
2022-12-05shell: Not not override the agl_shell interface resourcesMarius Vlad1-22/+30
This redoes a bit the way we assigned wl_resources created in case we got a bound_ok or bound_fail event. Previously, even if we get a 'bound_fail' event we would override the shell_client.resource which would make activation of the legitimate shell client impossible, so this change would make the shell_client.resource not being set if that happens. Secondly, this includes a reset change in the agl_shell destructor, a reset which is implicitly being done when the correct operations for the protocol specifications have been applied. Bug-AGL: SPEC-4503 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ie87ce3b937f041a5704407593f580895f188ef56
2022-12-05shell: Add a wrappers for sending events with agl-shellMarius Vlad1-8/+20
As we now have one more (shell) client that can bind to agl-shell, add a wrapper for sending the events and include it as well. Bug-AGL: SPEC-4503 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I869b036d6f24beeb3089bfd24b8d233c5fada71f
2022-12-05compositor: Allow to start other clientsMarius Vlad1-8/+6
This introduces shell-client-ext as a new section entry to add to allow starting the gRPC server helper client. Bug-AGL: SPEC-4503 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I41d62c932648699aa21837afc2de5103912c370d
2022-12-05agl-shell.xml: Introduce a new interfaceMarius Vlad1-7/+86
In order to allow another other client bind to agl_shell interface, this introduces a new specific interface which the client would bind to first, issue a doas_shell_client request, wait for a response, and proceeed further if the event received was successful. Afterwards, the client can bind to agl_shell protocol (and assuming it got 'bound_ok' event back) can further use the agl_shell protocol as it happens with the shell client. This approach avoids adding a new protocol interface and instead re-uses the same interface, with the note that the shell client is still in charge of handling background and panels. Bug-AGL: SPEC-4503 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Iac1d840a5f917b2a92fdfbdcdc583144d3942a1c
2022-11-14layout: Allow background surface roles (to) be activatedMarius Vlad1-1/+17
While nothing technically prevents the background surface role to be activated, it turns out we don't actually track it so we a) couldn't find it, and b) we attempted to resize it to an incorrect dimension. Another small follow-up commit from 'Add manual activation area configuration option' and with with commit 'agl-shell: Add support for defining an activation area', which introduced the ability to designate a certain area as the activation area. v2: Keep the background surface always mapped We now have more than one active surfaces at the same time, so we can't unmap it as it needs to be always displayed. Bug-AGL: SPEC-4594 Reported-by: Scott Murray <scott.murray@konsulko.com> Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I2561ce2c4c1c96c796fb8ee1c8ca9a30772b71f9
2022-11-01agl-shell: Add support for defining an activation areaMarius Vlad1-2/+23
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
2022-09-23compositor: Add missing SIGCHLD handlerMarius Vlad1-0/+32
We seem to be missing a SIGCHLD signal handlers so this patch adds one similarity to what weston has. Bug-AGL: SPEC-4570 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I137af4199c3d543fed940bbe289989095b114b74
2022-09-23shell: Rewrite client_exec as client_launchMarius Vlad1-57/+143
This patch is a major rewrite of the client_exec which fixes a couple of issues found by upstream. Specifically this address the following two issues: - Do not weston_log() after fork() - Own the session for the launched client These two issues were integrated into this single patch. It makes use of previously added wrappers to handle custom environment being passed to the (shell) client being executed. (Based on the work from https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/954 and from https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/817) Bug-AGL: SPEC-4509 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I29d4bcacba3671f67bb915bdb55a80b556e143ac
2022-09-14protocol/agl-shell.xml: Add an app_state event -- app state notificationMarius Vlad1-1/+10
This protocol bump will notify the client binding to the agl-shell protocol when a particular application changed its state. This includes four (4) different events: - started - terminated - activated - deactivated This should allow orchestrating start-up with activation as we don't really know when it would be the proper time to activate an application when starting up (for the first time). A started event will notify the shell client we it can do that. These events are not sticky such that the shell would be responsabile for keep track of the state, if it wants to. Bug-AGL: SPEC-4528 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Id162874fa68946bb9b1db9fa356dd617a0db9eb7
2022-09-14shell: Remove the black curtain installed on outputsMarius Vlad1-11/+23
Upon completion of activation we might have an output without a background surface set-up on that particular output, so this patch either uses the black curtain as a background surface (useful for transparent applications, which need it) or we remove it entirely in case the shell client has one installed. The patch renames the black_surface to black_curtain to better reflect its name. Also output filtering would need renaming (desktop_surface_check_last_surfaces) Bug-AGL: SPEC-4516 Reported-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I6071b07664772d891a4d8c33a7603573ec2069fa
2022-08-31agl-shell: Add bound_ok and bound_fail events and a default destructorMarius Vlad1-6/+69
As we're increasing the amount of combinations we could have in the AGL platforms, in which we're mixing various platforms, we require a way to tell clients that there's already a shell client which in charge. We can't really have multiple shell clients managing the windows and surfaces, but in the same time we don't want to sever the wayland connection the way it happens currently. Racy alternatives might exist, which avoid advertising the interface altogether once a client did bind to the interface but that's not really a viable solution. So instead of doing that, this patch introduces two new events which tells the client that it was either successful, and it can continue issue requests and receive events or a that it the bind failed. The client can chose to wait and try later and abandon to bind to the agl_shell intefface, and behave like a regular client. While doing an update to protocol to add those two events this patch add also a default destructor for the protocol. Bug-AGL: SPEC-4502 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Iacb86a668d1c4630724eecdb18e4b4c2d4e8e34a
2022-06-20shell: Fix a typo when adding surface to pending listMarius Vlad1-1/+1
As both names are similar this was probably a typo, and instead of using the iterator for the list we should use the item itself. This was pretty hard to track as initially everything was set-up alright. We were still getting empty lists of pending remote surfaces, when I observed that we were using the iterator rather than the new item we just create in that function. Bug-AGL: SPEC-4445 Reported-by: Scott Murray <scott.murray@konsulko.com> Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I77c4c6721eb4a4e3e8e66faa4fa0584b136d322e
2022-06-10shell: Make sure that app_id is valid before checking itMarius Vlad1-4/+4
Bug-AGL: SPEC-4412 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I427c2920315b223432f273d08a69a069d66310c9
2022-06-10shell: Extract some common functionsMarius Vlad1-12/+0
For instance this exports retreiving a ivi_seat from weston_seat, and they are useful in other parts as well. Bug-AGL: SPEC-4413 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I838823570792761dfb5ac4beea635e843dd5cd22
2022-06-03compositor: Properly dispose of fullscreen views at shutdownMarius Vlad1-0/+10
While we can have multiple outputs, each with its own fullscreen view, we have a layer-per-output hence we can't really call layer_fini() in the output destruction as that what would result in an invalid link access. Handle those views destruction and with it, the fullscreen layer fini, in the finalize bit where all others are handled as well. This fixes a crash at shutdown, which could be seen when using multiple outputs, and probably quite problematic when handling a restart. Fixes: 43bdf9a42bac33df174d6ac7ff1ab2e15441c7b5 Bug-AGL: SPEC-4420 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I773890a24ad8ca2556c1d4ddda7f37ebae02c9de
2022-05-04shell: Do not set none role for applications w/o appidMarius Vlad1-5/+0
With commit 'layout: Send dimensions when setting up property as fullscreen' we made so that fullscreen applications will receive the configure event right from the beginning but that changed a bit the way we handled applications that do not set-up an appid before doing the initial wl_surface.commit. Avoid doing that such that applications do not need to go through a resize. Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I91a9ab97ff5e30d3a86cda499d394c1a9fcde338
2022-05-04shell: Let the output destroy handler handle layer finiMarius Vlad1-12/+0
This way we don't race with it. Part of 'shell: Added missing layer fini calls'. Bug-AGL: SPEC-4351 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I366364ba128ca1dacd3d3639a1b74b02f3ceef21
2022-05-03shell: Added missing layer fini callsMarius Vlad1-0/+71
Newer libweston version introduced additional API to determine if we are missing out proper destruction paths. Bug-AGL: SPEC-4351 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I135ca463992244ae91512854c7da7004de48f72e
2022-05-03desktop: Remove dead codeMarius Vlad1-8/+0
Some dead code artefacts, no need to keep these in. Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Idca7f858592b422a0e028ed03e10f4bb418bcb40
2022-05-03layout: Send dimensions when setting up property as fullscreenMarius Vlad1-10/+16
Instead of doing it at commit time, do it right after getting the xdg toplevel surface such that clients can use it from the beginning. This now includes fullscreen, besides regular desktop roles, and it avoid mapping the fullscreen upon commit if the dimensions do not really match up. Bug-AGL: SPEC-4339 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I7185b10770c69d1d6572b0bc025c4a58fe431c67
2021-12-22agl-compositor: Add NULL check after creating surface/viewAndyZhou1-2/+6
Add a check to verify if both the surface/view was created successfully in function create_black_surface_view of src/shell.c file. Bug-AGL: SPEC-4193 Signed-off-by: ZhouMingying <zhoumy@cn.fujitsu.com> Change-Id: I69c6a6023c8b7a3b6e376f3cba25020a851648ab
2021-12-22agl-compositor:Add NULL check after zalloc in src directorymarlin_12.91.0marlin/12.91.012.91.0AndyZhou1-0/+40
There's no NULL check in zalloc. Add a NULL check after zalloc. And add memory free before return error. Bug-AGL: SPEC-4178 Signed-off-by: ZhouMingying <zhoumy@cn.fujitsu.com> Change-Id: Ic0e0e2007b2897a451507aed100ad01b65695383
2021-12-10shell: Refactor pending surfaces for existing pending onesMarius Vlad1-18/+128
This patch refactors a bit the way we add pending surface roles, such that it updates to an existing surface, rather than create a new one with the same app_id. Bug-AGL: SPEC-4133 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ifd7477ea0f0840d6fd82bbc21216a7694d0efa8b
2021-12-10src/desktop: Add a compositor destroy listenerMarius Vlad1-1/+1
Tearing down the ivi compositor instance (the shell) requires listening for such an event and handle any potential destruction of surfaces. With it we use to destroying any pending surfaces might have been left. Bug-AGL: SPEC-4133 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I911c590409700374007673da680b7a76f69be1b2
2021-12-08src/shell: Add set_app_property_mode requestMarius Vlad1-5/+55
Bug-AGL: SPEC-4133 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Iffc770e079788bb553077665169365dc7b2d901e
2021-11-05shell: Fix passing maximized state from the startMarius Vlad1-0/+47
We've added an optimization where we where sending to regular (desktop) surfaces from the beginning the maximized state, together with the size whenever the client signaled that it is ready to present. That optimization failed to take into account other potential roles, more importanly, the pop-op role which should not be getting any window state, and implicitly shouldn't be getting any surface dimensions, leaving it to the client to decide that. Patch checks all pending lists to make sure we're not skipping any on purpose. Bug-AGL: SPEC-4119 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I4f8c62af545c5955e7fa41c3fd73f52d6c73b600
2021-04-19layout: Remove weston_output_damage dependecyMarius Vlad1-2/+2
Doing a damage_below for the view should be sufficient to trigger a repaint. This way we don't actually need it. Bug-AGL: SPEC-3641 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I90f4c4c13571f441b35f933f2b93aaff7efd3481
2020-11-19shell: Throttle the log messageMarius Vlad1-1/+5
As libweston doesn't currently have a rate limiting the log message function, use a static variable to limit the amount of log message we might be seeing if application do not set-up an app_id. Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I4fb3a5b7421a154d8da483b2ac577df7a60e09cc
2020-11-19build/: Allow to build the compositor w/o walthamMarius Vlad1-0/+12
Provides empty implementations to avoid sprinking ifdefs everywhere. The transmitter plug-in does not expose a pkgconfig file we instead resort to test again waltham protocol (which is used by the transmitter) and the the remoting plug-in. Fixes a minor deps check in the meson file. Bug-AGL: SPEC-3691 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Id25d21d2ef0c6e55575c2e7685cda73e401db015
2020-11-18shell: Perform wl_list_init() after wl_list_remove()Walter Lozano1-0/+1
In order to follow the best practices perform wl_list_init() after wl_list_remove() on shell_ready. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Change-Id: Ia5ea915a5ad55e8251e3bc86c87ddfc140bbe592
2020-11-17desktop: Delay surface creation until committedWalter Lozano1-0/+3
Some frameworks like GTK-3 delay the set_app_id until title and parent are set, which makes ivi_check_pending_desktop_surface unable to set the proper role on surface_added. A consequence of this behaviour is that is not possible to use set_app_property to configure an application as popup. Instead, delay the creation of the surface until committed to give the chance to have a valid app_id configured. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Change-Id: I3f672fb365f48659711c866c45a21df6058a5a02
2020-11-05shell: Destroy weston_transmitter_surface as wellMarius Vlad1-0/+14
Instruct waltham-transmitter-plugin that it can destroy its own surface representation when the weston_surface is also destroyed. Bug-AGL: SPEC-3601, SPEC-3611 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ie0e5409b21c043b8c98bebb4d77808227ee38aca
2020-11-05shell: Keep a reference to weston_transmitter_surfaceMarius Vlad1-1/+2
When 'pushing' the surface store a reference of the weston_transmitter_surface so we can later inform the plug-in when the weston_surface is destroyed, so that it can also destroy the transmittter_surface from its side. Bug-AGL: SPEC-3601, SPEC-3611 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I7fd1df2130e53e8c226c7a751c598765608ae6b3
2020-11-05shell: Push the surface to the remote sideMarius Vlad1-0/+62
The receiver expects that the sender/transmitter will inform it when it can create a surface and it can start the gstreamer pipeline. The transmitter plug-in exposes a way to call that using 'push_surface' callback. So, whenever we detect that the remote surface is to be assigned to a waltham-type of output, we would need to call into this 'push_surface' callback. This acts as notification mechanism for the remote side. Bug-AGL: 3611 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ia5db0d8f2356708eaee3fbaabed2b3ba3ac97eb6
2020-11-05shell: Avoid creating and inserting black surfaceMarius Vlad1-2/+5
Creating and inserting the black surface will require to have an valid weston output. That might not be always the case so guard against no output being set. Bug-AGL: SPEC-3601 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: If7034bf0259fee164ba0f4b6a6ac3ef7d6bf30d6
2020-10-29main: Use the output handler to destroy to black viewMarius Vlad1-6/+1
Use the specific output destroyer handler, instead of destroying it in the handler itself. This way we can still clean-up and avoid any leaks, and still not trip ourselves causing a use-after-free, when the output is destroyed by libweston. Bug-AGL: SPEC-3630, SPEC-3672 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reported-by: Walter Lozano <walter.lozano@collabora.com> Change-Id: I11916245b85d2541286ee438284601b466dc20c2
2020-10-15shell: Advertise app when app_id is availableWalter Lozano1-1/+5
When using GTK-3 to create apps, the framework issues set_parent_id which forces a surface to be added even before the app_id is set. This causes the compositor to fail to advertise the app. This patch tries to overcome this issue by checking on surface commit if the surface was previously advertised, and do it if it was not. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Change-Id: I4e5fec82c1008c30d8ae7d213d85a82e39c404c3
2020-10-15shell: Avoid advertising applications without app_id setWalter Lozano1-0/+11
When using GTK-3 to create apps, the framework issues set_parent_id which forces a surface to be added even before the app_id is set. This causes the compositor to try to advertise an invalid app_id. This patch avoids advertising an app which has no app_id set. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Change-Id: Iadcea106e6464b41171a2aa92aa0eed3a8e2ff2d
2020-07-29layout: Advertise state change for other types of surface rolesMarius Vlad1-2/+1
Given that now other surfaces roles will be active by default, we need to let other application aware of that fact by advertising state change. Print some debug message while at it, to make it more consistent with the desktop role. Bug-AGL: SPEC-3494 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ia9d959a0912e330303fa3d959ce600237edf35b4
2020-07-29shell: Assume consistency with the desktop rolesMarius Vlad1-0/+4
While looking into activation by default of other surfaces, noticed that we're missing consistency on how we handle other types of surface roles. This patch, activate all other surfaces by default when starting up, even if they are started before or after the client shell. Expecting and assuming the same behaviour is important into trying to establish some common work-flow for applications. Bug-AGL: SPEC-3494 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I90e764c6c3a7ed543934ee6f68fa716d90ff151e
2020-06-29shell: Avoid checking against surfaces that do not have an app_idMarius Vlad1-4/+4
Not all application will set-up an app_id and we might end up checking against those. So avoid doing that because str* kind of like functions do not like that. Discovered when playing with cluster receiver and sub-surfaces. Bug-AGL: SPEC-3382 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I31b454fd3ccb1770775a00b1c953d9cbef827909
2020-06-26policy: Add a new policy hook to restrict access to private extensionsMarius Vlad1-1/+24
In this manner we can control which clients can bind to which interface (either the agl_shell one or the agl_shell_desktop one). Bug-AGL: SPEC-3394 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I9da4b3596dc5980b325aada8f8fcc7a11431c755
2020-06-15shell: Pass the bounding box values to the pop-up surfaceMarius Vlad1-3/+18
Necessary in order to make use options passed in with the protocol. Bug-AGL: SPEC-3419 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I0a2b973526572db18349642782082906544830a9