diff options
-rw-r--r-- | launcher/qml/Launcher.qml | 8 | ||||
-rw-r--r-- | launcher/src/homescreenhandler.cpp | 7 | ||||
-rw-r--r-- | launcher/src/homescreenhandler.h | 2 | ||||
-rw-r--r-- | launcher/src/shell-desktop.cpp | 25 | ||||
-rw-r--r-- | launcher/src/shell-desktop.h | 3 |
5 files changed, 41 insertions, 4 deletions
diff --git a/launcher/qml/Launcher.qml b/launcher/qml/Launcher.qml index f7f1c1b..27b0d3d 100644 --- a/launcher/qml/Launcher.qml +++ b/launcher/qml/Launcher.qml @@ -82,6 +82,7 @@ ApplicationWindow { property string currentId: '' property int newIndex: -1 property int index: grid.indexAt(loc.mouseX, loc.mouseY) + property string output_screen: '' x: 62 y: 264 onPressAndHold: currentId = applicationModel.id(newIndex = index) @@ -89,8 +90,13 @@ ApplicationWindow { if(loc.index < 0) { return } + + //if (applicationModel.appid(loc.index) === 'tbtnavi' || + // applicationModel.appid(loc.index) === 'hvac') { + // output_screen = 'Virtual-1' + //} if (currentId === '') { - homescreenHandler.tapShortcut(applicationModel.appid(loc.index)) + homescreenHandler.tapShortcut(applicationModel.appid(loc.index), output_screen) } else { currentId = '' } diff --git a/launcher/src/homescreenhandler.cpp b/launcher/src/homescreenhandler.cpp index 3c16c23..4d98414 100644 --- a/launcher/src/homescreenhandler.cpp +++ b/launcher/src/homescreenhandler.cpp @@ -172,7 +172,7 @@ void HomescreenHandler::init(int port, const char *token, QString myname) }); } -void HomescreenHandler::tapShortcut(QString application_id) +void HomescreenHandler::tapShortcut(QString application_id, QString output_name) { HMI_DEBUG("Launcher","tapShortcut %s", application_id.toStdString().c_str()); struct json_object* j_json = json_object_new_object(); @@ -181,7 +181,10 @@ void HomescreenHandler::tapShortcut(QString application_id) json_object_object_add(j_json, "area", value); mp_hs->showWindow(application_id.toStdString().c_str(), j_json); - aglShell->activate_app(nullptr, application_id, nullptr); + if (output_name.isEmpty()) + aglShell->activate_app(nullptr, application_id, nullptr); + else + aglShell->activate_app_by_screen(output_name, application_id, nullptr); } void HomescreenHandler::onRep_static(struct json_object* reply_contents) diff --git a/launcher/src/homescreenhandler.h b/launcher/src/homescreenhandler.h index ac490ce..471a663 100644 --- a/launcher/src/homescreenhandler.h +++ b/launcher/src/homescreenhandler.h @@ -35,7 +35,7 @@ public: void init(int port, const char* token, QString myname); - Q_INVOKABLE void tapShortcut(QString application_id); + Q_INVOKABLE void tapShortcut(QString application_id, QString output_name); Q_INVOKABLE void getRunnables(void); void onRep(struct json_object* reply_contents); diff --git a/launcher/src/shell-desktop.cpp b/launcher/src/shell-desktop.cpp index 42cc6d1..b8e6ef0 100644 --- a/launcher/src/shell-desktop.cpp +++ b/launcher/src/shell-desktop.cpp @@ -52,6 +52,31 @@ Shell::activate_app(QWindow *win, const QString &app_id, } void +Shell::activate_app_by_screen(const QString &screen_name, const QString &app_id, + const QString &app_data) +{ + QScreen *qscreen_to_put = nullptr; + for (auto &ss: qApp->screens()) { + if (ss->name() == screen_name) { + qscreen_to_put = ss; + break; + } + } + + /* use the primary one */ + if (!qscreen_to_put) { + qscreen_to_put = qApp->screens().first(); + } + + struct wl_output *output = getWlOutput(qscreen_to_put); + qDebug() << "will activate app: " << app_id << " on output " << + qscreen_to_put->name(); + agl_shell_desktop_activate_app(this->shell.get(), + app_id.toStdString().c_str(), + app_data.toStdString().c_str(), output); +} + +void Shell::deactivate_app(const QString &app_id) { agl_shell_desktop_deactivate_app(this->shell.get(), diff --git a/launcher/src/shell-desktop.h b/launcher/src/shell-desktop.h index a8f3326..f65e67d 100644 --- a/launcher/src/shell-desktop.h +++ b/launcher/src/shell-desktop.h @@ -56,6 +56,9 @@ public: public slots: // calls out of qml into CPP void activate_app(QWindow *win, const QString &app_id, const QString &app_data); + void activate_app_by_screen(const QString &screen_name, + const QString &app_id, + const QString &app_data); void deactivate_app(const QString &app_id); void set_window_props(QWindow *win, const QString &app_id, uint32_t props, int x, int y); |