summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-04-15 12:18:53 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-04-15 12:18:53 +0300
commite22bd28a5e1d11a8b608bd2a11b935ad5bcfc9b2 (patch)
tree926a7a04c4cb29f30b37c4a67c88e13c240aec23
parent3007e9ca8e0636e6a2a4e61eb113869bfcc1385b (diff)
sample/app: Allow to hang off data when activating the app
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--sample/app/eventhandler.cpp20
-rw-r--r--sample/app/protocol/agl-shell-desktop.xml17
2 files changed, 34 insertions, 3 deletions
diff --git a/sample/app/eventhandler.cpp b/sample/app/eventhandler.cpp
index 3a61887..b4b6a03 100644
--- a/sample/app/eventhandler.cpp
+++ b/sample/app/eventhandler.cpp
@@ -74,13 +74,24 @@ application_id_event(void *data, struct agl_shell_desktop *agl_shell_desktop,
return;
qInfo() << "app_id: " << app_id;
+}
- if (strcmp(app_id, "onescreenapp") == 0)
- emit ev_handler->signalOnReplyShowWindow(app_id);
+static void
+application_state_event(void *data, struct agl_shell_desktop *agl_shell_desktop,
+ const char *app_id, const char *app_data, uint32_t app_state, uint32_t app_role)
+{
+ /* unused */
+ (void) data;
+ (void) app_id;
+ (void) app_data;
+ (void) app_role;
+ (void) app_state;
+ (void) agl_shell_desktop;
}
static const struct agl_shell_desktop_listener agl_shell_desk_listener = {
application_id_event,
+ application_state_event,
};
static struct agl_shell_desktop *
@@ -202,7 +213,10 @@ void EventHandler::showWindow(QString id, QString json)
{
if (shell_desktop) {
struct wl_output *output = getWlOutput(qApp->screens().first());
- agl_shell_desktop_activate_app(shell_desktop, id.toStdString().c_str(), output);
+ agl_shell_desktop_activate_app(shell_desktop,
+ id.toStdString().c_str(),
+ json.toStdString().c_str(),
+ output);
}
qInfo() << "data from json: " << json.toStdString().c_str();
diff --git a/sample/app/protocol/agl-shell-desktop.xml b/sample/app/protocol/agl-shell-desktop.xml
index 6d53f92..05a3725 100644
--- a/sample/app/protocol/agl-shell-desktop.xml
+++ b/sample/app/protocol/agl-shell-desktop.xml
@@ -37,6 +37,11 @@
<entry name="fullscreen" value="1"/>
</enum>
+ <enum name="app_state">
+ <entry name="activated" value="0"/>
+ <entry name="deactivated" value="1"/>
+ </enum>
+
<event name="application">
<description summary="advertise application id">
The compositor may choose to advertise one or more application ids which
@@ -58,6 +63,7 @@
description of app_id.
</description>
<arg name="app_id" type="string"/>
+ <arg name="app_data" type="string" allow-null="true"/>
<arg name="output" type="object" interface="wl_output"/>
</request>
@@ -92,5 +98,16 @@
</description>
<arg name="app_id" type="string"/>
</request>
+
+ <event name="state_app">
+ <description summary="event sent when application has suffered state modification">
+ Notifies application(s) when other application have suffered state modifications.
+ </description>
+ <arg name="app_id" type="string"/>
+ <arg name="app_data" type="string" allow-null="true"/>
+ <arg name="state" type="uint" enum="app_state"/>
+ <arg name="role" type="uint" enum="app_role"/>
+ </event>
+
</interface>
</protocol>