diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2020-06-06 01:52:43 +0300 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2020-06-24 17:51:56 +0300 |
commit | 11b9762f115778309f732f10102a23f4598a4cf7 (patch) | |
tree | b3069548f8919ae8f8860c0f9868aa77b3980a39 /app | |
parent | 7c79b6ca1f47f095959da2cba7ac74205b6176ea (diff) |
Deactivate ourselves the first time we start
Fixes #SPEC-3412
Bug-AGL: SPEC-3412, SPEC-3447
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I3f2814fa88a0f27387889aacadd0849cd58b9b6a
Diffstat (limited to 'app')
-rw-r--r-- | app/main.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/app/main.cpp b/app/main.cpp index 035f2d9..8d731d2 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -35,6 +35,7 @@ #include <iostream> QString my_app_id = QString("alexa-viewer"); +static bool started = false; // this and the agl-shell extension should be added in some kind of a wrapper // for easy usage @@ -69,24 +70,37 @@ static void application_id_event(void *data, struct agl_shell_desktop *agl_shell_desktop, const char *app_id) { - (void) data; - (void) agl_shell_desktop; - // un-used + Shell *aglShell = static_cast<Shell *>(data); + qInfo() << "app_id: " << app_id; + + /* if we find our name here, means we just been started, as the application_id + * event is being sent when we connect, do distribute all the 'current' running + * applications/app_ids and when a new is being created */ + if (strcmp(app_id, my_app_id.toStdString().c_str())) + return; + + if (started) + return; + + /* we de-activate ourselves the first time we start, as we start as + * visible: 'false' */ + aglShell->deactivate_app(my_app_id); + started = true; + qDebug() << "appplication de-activated: " << my_app_id; } static void application_id_state(void *data, struct agl_shell_desktop *agl_shell_desktop, - const char *app_id, const char *app_data, uint32_t app_state, uint32_t app_role) + const char *app_id, const char *app_data, + uint32_t app_state, uint32_t app_role) { - (void) data; (void) app_data; - (void) app_role; - (void) app_state; - (void) app_id; (void) agl_shell_desktop; + (void) app_id; + (void) app_state; + (void) app_role; - // un-used } static const struct agl_shell_desktop_listener agl_shell_desk_listener = { @@ -239,10 +253,10 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - agl_shell_desktop_add_listener(shell, &agl_shell_desk_listener, NULL); std::shared_ptr<struct agl_shell_desktop> agl_shell{shell, agl_shell_desktop_destroy}; Shell *aglShell = new Shell(agl_shell, &app); + agl_shell_desktop_add_listener(shell, &agl_shell_desk_listener, aglShell); // before loading the QML we can tell the compositor that we'd like to // be a pop-up kind of window: we need to do this before creating the |