Fix errata in doxygen comment
[platform/core/appfw/appcore-widget.git] / src / widget_app.c
index 80d9cb8..b3c18c5 100755 (executable)
@@ -36,7 +36,7 @@
 #include <system_info.h>
 #include <vconf.h>
 #include <vconf-internal-keys.h>
-#include <aul_rsm_provider.h>
+#include <screen_connector_provider.h>
 
 #include "widget_app.h"
 #include "widget-log.h"
@@ -413,7 +413,7 @@ static int __instance_create(widget_class_h handle, const char *id, const char *
                return WIDGET_ERROR_OUT_OF_MEMORY;
 
        wc->state = WC_READY;
-       wc->id = g_strdup(id);
+       wc->id = strdup(id);
        wc->provider = handle;
        wc->win = NULL;
        wc->win_id = -1;
@@ -662,7 +662,7 @@ static void __destroy_all(int reason, int send_update)
                iter = g_list_next(iter);
                switch (cxt->state) {
                case WC_PAUSED:
-                       LOGD("destroy %s", cxt->state, cxt->id);
+                       LOGD("destroy %d : %s", cxt->state, cxt->id);
                        __instance_destroy(cxt->provider, cxt->id, reason, send_update);
                        break;
                }
@@ -891,8 +891,7 @@ static int __before_loop(int argc, char **argv)
                _E("failed to get launch argv"); /* LCOV_EXCL_LINE */
        }
 
-       aul_rsm_provider_init();
-
+       screen_connector_provider_init();
        elm_init(argc, argv);
 
        r = aul_launch_init(__aul_handler, NULL);
@@ -963,7 +962,7 @@ static void __after_loop()
        if (app_ops->terminate)
                app_ops->terminate(app_user_data);
 
-       aul_rsm_provider_fini();
+       screen_connector_provider_fini();
 
        _widget_app_free_viewer_endpoint();
        _widget_core_unset_appcore_event_cb();
@@ -974,6 +973,11 @@ static void __after_loop()
                package_id = NULL;
        }
 
+       if (appid) {
+               free(appid);
+               appid = NULL;
+       }
+
        elm_shutdown();
 }
 
@@ -1149,8 +1153,13 @@ EXPORT_API int widget_app_main(int argc, char **argv,
        app_ops = callback;
        app_user_data = user_data;
        r = __before_loop(argc, argv);
-       if (r < 0)
+       if (r < 0) {
+               if (appid) {
+                       free(appid);
+                       appid = NULL;
+               }
                return r;
+       }
 
        ecore_main_loop_begin();
        aul_status_update(STATUS_DYING);
@@ -1346,6 +1355,14 @@ EXPORT_API const char *widget_app_get_id(widget_context_h context)
        return context->id;
 }
 
+static void _win_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       /* Remove data used in accessibility */
+       char *plug_id;
+       plug_id = evas_object_data_del(obj, "___PLUGID");
+       free(plug_id);
+}
+
 EXPORT_API int widget_app_get_elm_win(widget_context_h context,
                                        Evas_Object **win)
 {
@@ -1353,6 +1370,8 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
        Evas_Object *ret_win;
        Ecore_Wl_Window *wl_win;
        struct wl_surface *surface;
+       char buffer[256];
+       int rots[3] = {0};
 
        if (!_is_widget_feature_enabled()) {
                _E("not supported"); /* LCOV_EXCL_LINE */
@@ -1369,6 +1388,9 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
                goto fault; /* LCOV_EXCL_LINE */
        }
 
+       elm_win_wm_rotation_preferred_rotation_set(ret_win, -1);
+       elm_win_wm_rotation_available_rotations_set(ret_win, rots, 1);
+
        wl_win = elm_win_wl_window_get(ret_win);
        if (wl_win == NULL) {
                _E("failed to get wayland window"); /* LCOV_EXCL_LINE */
@@ -1380,8 +1402,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
                _E("failed to get surface"); /* LCOV_EXCL_LINE */
                goto fault; /* LCOV_EXCL_LINE */
        }
-
-       aul_rsm_provider_remote_enable(cxt->id, surface);
+       screen_connector_provider_remote_enable(cxt->id, surface);
 
        ecore_wl_window_class_name_set(wl_win, cxt->id);
        elm_win_aux_hint_add(ret_win, "wm.policy.win.user.geometry", "1");
@@ -1390,6 +1411,11 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context,
        cxt->win = ret_win;
        cxt->win_id = ecore_wl_window_id_get(wl_win);
 
+       /* Set data to use in accessibility */
+       snprintf(buffer, sizeof(buffer), "%s:%d", cxt->id, getpid());
+       evas_object_data_set(ret_win, "___PLUGID", strdup(buffer));
+       evas_object_event_callback_add(ret_win, EVAS_CALLBACK_DEL, _win_del_cb, NULL);
+
        _D("window created: %d", cxt->win_id);
 
        return WIDGET_ERROR_NONE;
@@ -1522,6 +1548,7 @@ EXPORT_API int widget_app_context_set_content_info(widget_context_h context,
        else
                context->content = NULL;
 
+       free(raw);
        if (ret < 0) {
                /* LCOV_EXCL_START */
                _E("failed to send content info: %s of %s (%d)", context->id,