diff options
author | 2020-04-10 19:41:16 +0300 | |
---|---|---|
committer | 2020-04-13 17:25:03 +0300 | |
commit | 831dc2946ce773ce2ed944ea9253350e5dd081bb (patch) | |
tree | 84c822173f20750109a0fd1c605013726e9a4f33 | |
parent | cd39ff2c9987904617c53685a75f5fe89513ce81 (diff) |
sample/app: Allow to set-up the onscreenapp as pop-up
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r-- | sample/app/eventhandler.cpp | 11 | ||||
-rw-r--r-- | sample/app/eventhandler.h | 1 | ||||
-rw-r--r-- | sample/app/main.qml | 6 |
3 files changed, 18 insertions, 0 deletions
diff --git a/sample/app/eventhandler.cpp b/sample/app/eventhandler.cpp index 58f99fc..3a61887 100644 --- a/sample/app/eventhandler.cpp +++ b/sample/app/eventhandler.cpp @@ -242,3 +242,14 @@ EventHandler::is_running(const QString &app_id) return false; } + +void +EventHandler::set_window_popup(const QString &app_id, int x, int y) +{ + struct wl_output *output = getWlOutput(qApp->screens().first()); + + if (shell_desktop) + agl_shell_desktop_set_app_property(shell_desktop, + app_id.toStdString().c_str(), + AGL_SHELL_DESKTOP_APP_ROLE_POPUP, x, y, output); +} diff --git a/sample/app/eventhandler.h b/sample/app/eventhandler.h index 77e01e6..96e44ae 100644 --- a/sample/app/eventhandler.h +++ b/sample/app/eventhandler.h @@ -59,6 +59,7 @@ public: Q_INVOKABLE void hideWindow(QString id); Q_INVOKABLE int start(const QString &app_id); Q_INVOKABLE bool is_running(const QString &app_id); + Q_INVOKABLE void set_window_popup(const QString &app_id, int x, int y); signals: void signalOnReplyShowWindow(QVariant val); diff --git a/sample/app/main.qml b/sample/app/main.qml index f0a65e9..2979d88 100644 --- a/sample/app/main.qml +++ b/sample/app/main.qml @@ -20,6 +20,7 @@ ApplicationWindow { property string postmsg: qsTr("") property string btndata: qsTr("") property int pid: -1 + property bool onscreen_role_set: false Label { id: title @@ -340,6 +341,11 @@ ApplicationWindow { else postmsg += "}" + if (!onscreen_role_set) { + eventHandler.set_window_poup(onsId, 0, 218) + onscreen_role_set = true + } + // if the application is not already started, start it if (pid == -1) { // if the application is not started, then the first time |