From: Junghoon Park Date: Thu, 23 Mar 2017 12:05:07 +0000 (+0900) Subject: Add APIs for attaching and detaching window X-Git-Tag: accepted/tizen/unified/20170406.053936~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ceb1abec0d1f03a1eba5b9a896d51f60974df789;p=platform%2Fcore%2Fappfw%2Faul-1.git Add APIs for attaching and detaching window Change-Id: I75a3465b58f898e691ffe2ba65dce9e49e39ad0d Signed-off-by: Junghoon Park --- diff --git a/include/aul.h b/include/aul.h index 2b0769b..f57be06 100644 --- a/include/aul.h +++ b/include/aul.h @@ -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 diff --git a/include/aul_cmd.h b/include/aul_cmd.h index 9332623..0bdf03c 100644 --- a/include/aul_cmd.h +++ b/include/aul_cmd.h @@ -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 }; diff --git a/include/aul_window.h b/include/aul_window.h index 5286f8a..dd7f507 100755 --- a/include/aul_window.h +++ b/include/aul_window.h @@ -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 } diff --git a/src/aul_window.c b/src/aul_window.c index 9dde03b..fad56d9 100644 --- a/src/aul_window.c +++ b/src/aul_window.c @@ -22,9 +22,12 @@ #include #include +#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; +}