From 874de0edae31134513982a9d28ca4327f4876e38 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Wed, 22 Jul 2020 19:07:47 +0300 Subject: [PATCH] shell: Make use of aglShell wrapper to activate apps Signed-off-by: Marius Vlad --- homescreen/src/homescreenhandler.cpp | 15 ++------------- homescreen/src/shell.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp index bf98a53..e13ba53 100644 --- a/homescreen/src/homescreenhandler.cpp +++ b/homescreen/src/homescreenhandler.cpp @@ -95,24 +95,13 @@ getWlOutput(QPlatformNativeInterface *native, QScreen *screen) void HomescreenHandler::tapShortcut(QString application_id) { HMI_DEBUG("HomeScreen","tapShortcut %s", application_id.toStdString().c_str()); - - struct json_object* j_json = json_object_new_object(); - struct json_object* value; - - struct agl_shell *agl_shell = aglShell->shell.get(); - QPlatformNativeInterface *native = qApp->platformNativeInterface(); - struct wl_output *output = getWlOutput(native, qApp->screens().first()); - - value = json_object_new_string("normal.full"); - json_object_object_add(j_json, "area", value); - - mp_hs->showWindow(application_id.toStdString().c_str(), j_json); + mp_hs->showWindow(application_id.toStdString().c_str(), nullptr); // this works (and it is redundant the first time), due to the default // policy engine installed which actives the application, when starting // the first time. Later calls to HomescreenHandler::tapShortcut will // require calling 'agl_shell_activate_app' - agl_shell_activate_app(agl_shell, application_id.toStdString().c_str(), output); + aglShell->activate_app(nullptr, application_id); } void HomescreenHandler::onRep_static(struct json_object* reply_contents) diff --git a/homescreen/src/shell.cpp b/homescreen/src/shell.cpp index bf68f96..ccdcbab 100644 --- a/homescreen/src/shell.cpp +++ b/homescreen/src/shell.cpp @@ -40,12 +40,16 @@ void Shell::activate_app(QWindow *win, const QString &app_id) { QPlatformNativeInterface *native = qApp->platformNativeInterface(); - QScreen *screen = win->screen(); + struct wl_output *output; + QScreen *screen = nullptr; - struct wl_output *output = getWlOutput(native, screen); + if (!win) + screen = qApp->screens().first(); + else + screen = win->screen(); + output = getWlOutput(native, screen); qDebug() << "++ activating app_id " << app_id.toStdString().c_str(); - agl_shell_desktop_activate_app(this->shell_desktop.get(), app_id.toStdString().c_str(), NULL, output); } -- 2.16.6