e_policy_conformant: Added part_add/del api
authorJuyeon Lee <juyeonne.lee@samsung.com>
Fri, 14 Jul 2017 11:45:24 +0000 (20:45 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 27 Jul 2017 01:59:33 +0000 (10:59 +0900)
e_modules can register/deregister conformant part by calling below apis
 e_policy_conformant_part_add(E_Client *ec) and
 e_policy_conformant_part_del(E_Client *ec)

Change-Id: I2feb86e90154b3ef8f88b4ccec6e2ef7dbee84d7

src/bin/Makefile.mk
src/bin/e_includes.h
src/bin/e_policy.c
src/bin/e_policy_conformant.c
src/bin/e_policy_conformant.h
src/bin/e_policy_conformant_internal.h [new file with mode: 0644]
src/bin/e_policy_wl.c

index c101517bc213dd8d42ac12cce183d62ef6b4a30d..b528e6aa7e70b6f24869d9f86e726eb96620ced0 100644 (file)
@@ -105,6 +105,7 @@ src/bin/services/e_service_indicator.h \
 src/bin/services/e_service_cbhm.h \
 src/bin/services/e_service_scrsaver.h \
 src/bin/e_policy.h \
+src/bin/e_policy_conformant.h \
 src/bin/e_policy_visibility.h \
 src/bin/e_policy_private_data.h \
 src/bin/e_policy_wl.h \
index d9f4f4e7f186031ad0e6af0c4f41e1ba7a80134d..5708dfce2eb73930f40bf2b767780d28bfcffa92 100644 (file)
@@ -59,6 +59,7 @@
 #endif
 #include "e_comp_wl_rsm.h"
 #include "e_policy.h"
+#include "e_policy_conformant.h"
 #include "e_policy_visibility.h"
 #include "e_process.h"
 #include "e_splitlayout.h"
index 91c2b59e0b3b62af23202455d12cc7dec9558c6c..491e4335ab03a94171e04112b3cd150a145994ce 100644 (file)
@@ -1,5 +1,5 @@
 #include "e.h"
-#include "e_policy_conformant.h"
+#include "e_policy_conformant_internal.h"
 #include "e_policy_wl.h"
 #include "e_policy_visibility.h"
 #include "e_policy_private_data.h"
index 9b24d3fb3f6f7ded3fed78192a8d61c69ffd4fb1..763ac944f352c698126330ff995141bae7ae20fd 100644 (file)
@@ -631,6 +631,47 @@ _conf_part_register(E_Client *ec, Conformant_Type type)
    evas_object_smart_callback_add(ec->frame, "hiding", _conf_cb_part_obj_hiding, (void*)type);
 }
 
+static void
+_conf_part_deregister(E_Client *ec, Conformant_Type type)
+{
+   Defer_Job *job;
+
+   if (!g_conf)
+     return;
+
+   if (!g_conf->part[type].ec)
+     {
+        INF("Can't deregister ec(%p) for %s. no ec has been registered",
+            ec, _conf_type_to_str(type));
+        return;
+     }
+   else if (g_conf->part[type].ec != ec)
+     {
+        INF("Can't deregister ec(%p) for %s. ec(%p) was not registered.",
+            ec, _conf_type_to_str(type), g_conf->part[type].ec);
+        return;
+     }
+
+   // deregister callback
+   evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_DEL,      _conf_cb_part_obj_del,     (void*)type);
+   evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_SHOW,     _conf_cb_part_obj_show,    (void*)type);
+   evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_HIDE,     _conf_cb_part_obj_hide,    (void*)type);
+   evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_MOVE,     _conf_cb_part_obj_move,    (void*)type);
+   evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_RESIZE,   _conf_cb_part_obj_resize,  (void*)type);
+
+   evas_object_smart_callback_del_full(ec->frame, "hiding", _conf_cb_part_obj_hiding, (void*)type);
+
+
+   g_conf->part[type].ec = NULL;
+   g_conf->part[type].state.will_hide = EINA_FALSE;
+   g_conf->part[type].last_serial = 0;
+   EINA_LIST_FREE(g_conf->part[type].defer_jobs, job)
+     {
+        e_client_hook_del(job->owner_del_hook);
+        free(job);
+     }
+}
+
 static Eina_Bool
 _conf_cb_client_add(void *data, int evtype EINA_UNUSED, void *event)
 {
@@ -917,17 +958,63 @@ _conf_event_shutdown(void)
    E_FREE_FUNC(g_conf->idle_enterer, ecore_idle_enterer_del);
 }
 
-EINTERN void
+E_API Eina_Bool
 e_policy_conformant_part_add(E_Client *ec)
 {
    Conformant_Type type = CONFORMANT_TYPE_MAX;
 
-   EINA_SAFETY_ON_NULL_RETURN(g_conf);
+   if (!g_conf) return EINA_FALSE;
+   if (!ec) return EINA_FALSE;
 
    type = _conf_client_type_get(ec);
-   EINA_SAFETY_ON_TRUE_RETURN(type >= CONFORMANT_TYPE_MAX);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(type >= CONFORMANT_TYPE_MAX, EINA_FALSE);
 
    _conf_part_register(ec, type);
+
+   g_conf->part[type].changed = 1;
+
+   return EINA_TRUE;
+}
+
+E_API Eina_Bool
+e_policy_conformant_part_del(E_Client *ec)
+{
+   Conformant_Type type, t;
+
+   if (!g_conf) return EINA_FALSE;
+   if (!ec) return EINA_FALSE;
+
+   type = CONFORMANT_TYPE_MAX;
+
+   // find part whether ec has registered
+   for (t = 0; t < CONFORMANT_TYPE_MAX; t++)
+     {
+        if (g_conf->part[t].ec == ec)
+          {
+             type = t;
+             break;
+          }
+     }
+
+   if (type >= CONFORMANT_TYPE_MAX)
+     return EINA_FALSE;
+
+   _conf_state_update(type,
+                      EINA_FALSE,
+                      g_conf->part[type].state.x,
+                      g_conf->part[type].state.y,
+                      g_conf->part[type].state.w,
+                      g_conf->part[type].state.h);
+
+   g_conf->part[type].owner = NULL;
+   g_conf->part[type].state.will_hide = EINA_FALSE;
+
+   if (type == CONFORMANT_TYPE_CLIPBOARD)
+     e_policy_stack_transient_for_set(g_conf->part[type].ec, NULL);
+
+   _conf_part_deregister(ec, type);
+
+   return EINA_TRUE;
 }
 
 EINTERN void
index f9085f9fb36a1d4878847d04b62272471a0a8918..6949c5de38b0f5a1efb4be727f840a049d34d863 100644 (file)
@@ -1,12 +1,10 @@
 #ifndef E_POLICY_CONFORMANT_H
 #define E_POLICY_CONFORMANT_H
 
-EINTERN Eina_Bool  e_policy_conformant_init(void);
-EINTERN void       e_policy_conformant_shutdown(void);
-EINTERN void       e_policy_conformant_part_add(E_Client *ec);
-EINTERN void       e_policy_conformant_client_add(E_Client *ec, struct wl_resource *res);
-EINTERN void       e_policy_conformant_client_del(E_Client *ec);
-EINTERN Eina_Bool  e_policy_conformant_client_check(E_Client *ec);
-EINTERN void       e_policy_conformant_client_ack(E_Client *ec, struct wl_resource *res, uint32_t serial);
+EINTERN Eina_Bool           e_policy_conformant_init(void);
+EINTERN void                e_policy_conformant_shutdown(void);
+
+E_API Eina_Bool             e_policy_conformant_part_add(E_Client *ec);
+E_API Eina_Bool             e_policy_conformant_part_del(E_Client *ec);
 
 #endif
diff --git a/src/bin/e_policy_conformant_internal.h b/src/bin/e_policy_conformant_internal.h
new file mode 100644 (file)
index 0000000..e4726af
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef E_POLICY_CONFORMANT_INTERNAL_H
+#define E_POLICY_CONFORMANT_INTERNAL_H
+
+EINTERN void       e_policy_conformant_client_add(E_Client *ec, struct wl_resource *res);
+EINTERN void       e_policy_conformant_client_del(E_Client *ec);
+EINTERN Eina_Bool  e_policy_conformant_client_check(E_Client *ec);
+EINTERN void       e_policy_conformant_client_ack(E_Client *ec, struct wl_resource *res, uint32_t serial);
+
+#endif
index de3fe305775a106712afc6e98fb126943d5757d6..155142ad96d6a353bbbf105f3bbeeb1c12e73ace 100644 (file)
@@ -7,7 +7,7 @@
 #include "services/e_service_cbhm.h"
 #include "services/e_service_scrsaver.h"
 #include "e_policy_wl_display.h"
-#include "e_policy_conformant.h"
+#include "e_policy_conformant_internal.h"
 #include "e_policy_visibility.h"
 
 #include <device/display.h>