aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-05-29 13:30:15 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-06-24 17:05:32 +0300
commitfc41fa6da7f64262a7bbc4313b920762e1a31d15 (patch)
tree377e945d5398863e4eb262b80a5e0d83da4dc4c4
parent259c66b9ebde64e857f36d8d1d7050bec2e8f41d (diff)
homescreenhandler: Add the ability to specify the output based on the
screen Pass the output when activing the surface in Launcher.qml Bug-AGL: SPEC-3447 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I4b8f03c90712290f580a570cd2644a4bc44687c5
-rw-r--r--launcher/qml/Launcher.qml8
-rw-r--r--launcher/src/homescreenhandler.cpp7
-rw-r--r--launcher/src/homescreenhandler.h2
-rw-r--r--launcher/src/shell-desktop.cpp25
-rw-r--r--launcher/src/shell-desktop.h3
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);