#include "homescreenhandler.h"
#include "hmi-debug.h"
+QScreen *find_screen(const char *output);
+
// defined by meson build file
#include QT_QPA_HEADER
// a user session by systemd
#define LAUNCHER_APP_ID "launcher"
+static struct wl_output *
+getWlOutput(QPlatformNativeInterface *native, QScreen *screen);
+
HomescreenHandler::HomescreenHandler(Shell *_aglShell, ApplicationLauncher *launcher, QObject *parent) :
QObject(parent),
aglShell(_aglShell)
{
mp_launcher = launcher;
mp_applauncher_client = new AppLauncherClient();
+ QPlatformNativeInterface *native = qApp->platformNativeInterface();
//
// The "started" event is received any time a start request is made to applaunchd,
{
struct agl_shell *agl_shell = aglShell->shell.get();
QPlatformNativeInterface *native = qApp->platformNativeInterface();
- struct wl_output *output = getWlOutput(native, qApp->screens().first());
+ struct wl_output *mm_output = getWlOutput(native, qApp->screens().first());
if (mp_launcher) {
mp_launcher->setCurrent(app_id);
}
+ HMI_DEBUG("HomeScreen", "Activating app_id %s by default output %p\n",
+ app_id.toStdString().c_str(), mm_output);
+
+ // search for a pending application which might have a different output
+ auto iter = pending_app_list.begin();
+ bool found_pending_app = false;
+ while (iter != pending_app_list.end()) {
+ const QString &app_to_search = iter->first;
+
+ if (app_to_search == app_id) {
+ found_pending_app = true;
+ break;
+ }
+
+ iter++;
+ }
+
+ if (found_pending_app) {
+ const QString &output_name = iter->second;
+ QScreen *screen =
+ ::find_screen(output_name.toStdString().c_str());
+
+ mm_output = getWlOutput(native, screen);
+ pending_app_list.erase(iter);
+
+ HMI_DEBUG("HomeScreen", "For application %s found another "
+ "output to activate %s\n",
+ app_id.toStdString().c_str(),
+ output_name.toStdString().c_str());
+ }
+
+ HMI_DEBUG("HomeScreen", "Activating application %s",
+ app_id.toStdString().c_str());
- HMI_DEBUG("HomeScreen", "Activating application %s", app_id.toStdString().c_str());
- agl_shell_activate_app(agl_shell, app_id.toStdString().c_str(), output);
+ agl_shell_activate_app(agl_shell, app_id.toStdString().c_str(), mm_output);
}
void HomescreenHandler::deactivateApp(const QString& app_id)