#include "e.h"
#include "e_policy_wl.h"
#include "e_desk_area_intern.h"
+#include "e_client_intern.h"
#include <libds-tizen/screen.h>
*/
typedef struct _E_Desk_Private E_Desk_Private;
+typedef struct _E_Desk_Private_Client E_Desk_Private_Client;
typedef struct _E_Desk_Smart_Data E_Desk_Smart_Data;
#define DESK_EC_DATA_KEY "E_Desk_Client"
struct wl_listener splitscreen_deactivate;
};
+struct _E_Desk_Private_Client
+{
+ E_Desk *desk;
+ E_Client *ec;
+
+ // client listeners
+ struct wl_listener client_destroy;
+};
+
struct _E_Desk_Smart_Data
{
Evas_Object_Smart_Clipped_Data base;
#endif
}
+#ifdef REFACTOR_DESK_AREA
+static void
+_e_desk_private_client_del(E_Desk_Private_Client *desk_client)
+{
+ E_Desk *desk = desk_client->desk;
+ E_Client *ec = desk_client->ec;
+ E_Desk_Area *eda;
+
+ _e_desk_smart_client_del(desk->smart_obj, ec);
+ _e_desk_client_data_del(desk, ec);
+
+ // TODO: Remove ec has to be done at _desk_area_cb_client_destroy callback
+ eda = e_desk_desk_area_base_get(desk);
+ e_desk_area_ec_remove(eda, ec);
+
+ wl_list_remove(&desk_client->client_destroy.link);
+
+ E_FREE(desk_client);
+}
+
+static void
+_desk_cb_client_destroy(struct wl_listener *listener, void *data)
+{
+ E_Desk_Private_Client *desk_client;
+ E_Desk *desk;
+ E_Client *ec;
+
+ desk_client = wl_container_of(listener, desk_client, client_destroy);
+ desk = desk_client->desk;
+ ec = desk_client->ec;
+
+ ELOGF("DESK", "CLIENT DESTROY. desk:%p", ec, desk);
+
+ _e_desk_private_client_del(desk_client);
+}
+#endif
+
EINTERN void
e_desk_client_add(E_Desk *desk, E_Client *ec)
{
#ifdef REFACTOR_DESK_AREA
E_Desk_Area *eda;
+ E_Desk_Private_Client *desk_client;
#endif
E_OBJECT_CHECK(desk);
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
if (e_desk_has_ec(desk, ec)) return;
- ELOGF("DESK", "CLIENT ADD", ec);
+ ELOGF("DESK", "CLIENT ADD. desk:%p", ec, desk);
+
+#ifdef REFACTOR_DESK_AREA
+
+ desk_client = E_NEW(E_Desk_Private_Client, 1);
+ EINA_SAFETY_ON_NULL_RETURN(desk_client);
+
+ desk_client->desk = desk;
+ desk_client->ec = ec;
+
+ // e_client listeners
+ desk_client->client_destroy.notify = _desk_cb_client_destroy;
+ e_client_destroy_listener_add(ec, &desk_client->client_destroy);
+#endif
_e_desk_client_set(desk, ec);
_e_desk_client_data_set(desk, ec);
#endif
}
+#ifdef REFACTOR_DESK_AREA
+static E_Desk_Private_Client *
+_e_desk_private_client_get(E_Client *ec)
+{
+ E_Desk_Private_Client *desk_client;
+ struct wl_listener *listener;
+
+ listener = e_client_destroy_listener_get(ec, _desk_cb_client_destroy);
+ if (!listener) return NULL;
+
+ return wl_container_of(listener, desk_client, client_destroy);
+}
+#endif
+
E_API void
e_desk_client_del(E_Desk *desk, E_Client *ec)
{
#ifdef REFACTOR_DESK_AREA
- E_Desk_Area *eda;
+ E_Desk_Private_Client *desk_client;
#endif
E_OBJECT_CHECK(desk);
E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE);
E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE);
#ifdef REFACTOR_DESK_AREA
- _e_desk_smart_client_del(desk->smart_obj, ec);
-
- ELOGF("DESK", "CLIENT DEL", ec);
+ ELOGF("DESK", "CLIENT REMOVE. desk:%p", ec, desk);
- eda = e_desk_desk_area_base_get(desk);
- e_desk_area_ec_remove(eda, ec);
+ desk_client = _e_desk_private_client_get(ec);
+ EINA_SAFETY_ON_NULL_RETURN(desk_client);
- _e_desk_client_data_del(desk, ec);
+ _e_desk_private_client_del(desk_client);
#else
_e_desk_smart_client_del(desk->smart_obj, ec);