sample/app: Allow to hang off data when activating the app
authorMarius Vlad <marius.vlad@collabora.com>
Wed, 15 Apr 2020 09:18:53 +0000 (12:18 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 15 Apr 2020 09:18:53 +0000 (12:18 +0300)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
sample/app/eventhandler.cpp
sample/app/protocol/agl-shell-desktop.xml

index 3a61887..b4b6a03 100644 (file)
@@ -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();
index 6d53f92..05a3725 100644 (file)
       <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>
 
       </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>