Add APIs for attaching and detaching window 46/120646/4
authorJunghoon Park <jh9216.park@samsung.com>
Thu, 23 Mar 2017 12:05:07 +0000 (21:05 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Fri, 31 Mar 2017 04:02:49 +0000 (21:02 -0700)
Change-Id: I75a3465b58f898e691ffe2ba65dce9e49e39ad0d
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
include/aul.h
include/aul_cmd.h
include/aul_window.h
src/aul_window.c

index 2b0769b..f57be06 100644 (file)
@@ -268,6 +268,11 @@ typedef enum aul_widget_instance_event {
 #define AUL_K_SCREEN_TYPE      "__AUL_SCREEN_TYPE__"
 /** AUL internal private key */
 #define AUL_K_VIEWER_REF       "__AUL_VIEWER_REF__"
+/** AUL internal private key */
+#define AUL_K_PARENT_APPID     "__AUL_PARENT_APPID__"
+/** AUL internal private key */
+#define AUL_K_CHILD_APPID      "__AUL_CHILD_APPID__"
+
 
 /**
  * @brief      This is callback function for aul_launch_init
index 9332623..0bdf03c 100644 (file)
@@ -120,6 +120,8 @@ enum app_cmd {
        APP_INVALIDATE_CACHE = 90,
 
        APP_STARTUP_SIGNAL = 91,
+       APP_WINDOW_ATTACH = 92,
+       APP_WINDOW_DETACH = 93,
 
        APP_CMD_MAX
 };
index 5286f8a..dd7f507 100755 (executable)
@@ -187,6 +187,15 @@ int aul_window_info_get_geometry(aul_window_info_h info, int *x, int *y, int *w,
 */
 int aul_window_get_focused_pid(pid_t *pid);
 
+/*
+ * This API is only for Appfw internally.
+ */
+int aul_window_attach(const char *parent_appid, const char *child_appid);
+
+/*
+ * This API is only for Appfw internally.
+ */
+int aul_window_detach(const char *child_appid);
 
 #ifdef __cplusplus
 }
index 9dde03b..fad56d9 100644 (file)
 #include <glib.h>
 #include <malloc.h>
 
+#include "aul.h"
+#include "launch.h"
 #include "aul_api.h"
 #include "aul_util.h"
 #include "aul_window.h"
+#include "aul_cmd.h"
 
 static GDBusConnection *system_conn;
 
@@ -314,5 +317,47 @@ out:
        return res;
 }
 
+API int aul_window_attach(const char *parent_appid, const char *child_appid)
+{
+       bundle *b;
+       int ret;
+
+       if (parent_appid == NULL || child_appid == NULL)
+               return -1;
+
+       b = bundle_create();
+       if (!b) {
+               _E("out of memory");
+               return -1;
+       }
+
+       bundle_add_str(b, AUL_K_PARENT_APPID, parent_appid);
+       bundle_add_str(b, AUL_K_CHILD_APPID, child_appid);
 
+       ret = app_send_cmd(AUL_UTIL_PID, APP_WINDOW_ATTACH, b);
+       bundle_free(b);
 
+       return ret;
+}
+
+API int aul_window_detach(const char *child_appid)
+{
+       bundle *b;
+       int ret;
+
+       if (child_appid == NULL)
+               return -1;
+
+       b = bundle_create();
+       if (!b) {
+               _E("out of memory");
+               return -1;
+       }
+
+       bundle_add_str(b, AUL_K_CHILD_APPID, child_appid);
+
+       ret = app_send_cmd(AUL_UTIL_PID, APP_WINDOW_DETACH, b);
+       bundle_free(b);
+
+       return ret;
+}