From ed9b1070e86396787df74cf017581b0f53b7b51f Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 11 Jul 2024 19:51:05 +0900 Subject: [PATCH] e_policy: add e_policy files Change-Id: Ie8c50e39cd6d19b6ace8a2b2f1cee5e9e89e785d --- src/bin/Makefile.mk | 3 + src/bin/compmgr/e_comp_canvas.c | 26 +++++++++ src/bin/core/e_intern.h | 2 + src/bin/windowmgr/e_policy.c | 15 ++++- src/bin/windowmgr/e_policy_desk.c | 8 +++ src/bin/windowmgr/e_policy_desk_area.c | 10 ++++ src/bin/windowmgr/e_policy_desk_area_intern.h | 7 +++ src/bin/windowmgr/e_policy_desk_intern.h | 17 ++++++ src/bin/windowmgr/e_policy_intern.h | 13 +++++ src/bin/windowmgr/e_policy_zone.c | 58 +++++++++++++++++++ src/bin/windowmgr/e_policy_zone_intern.h | 11 ++++ 11 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 src/bin/windowmgr/e_policy_desk.c create mode 100644 src/bin/windowmgr/e_policy_desk_area.c create mode 100644 src/bin/windowmgr/e_policy_desk_area_intern.h create mode 100644 src/bin/windowmgr/e_policy_desk_intern.h create mode 100644 src/bin/windowmgr/e_policy_zone.c create mode 100644 src/bin/windowmgr/e_policy_zone_intern.h diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk index 193ed8bd99..7f1c843ad7 100644 --- a/src/bin/Makefile.mk +++ b/src/bin/Makefile.mk @@ -204,6 +204,9 @@ src/bin/windowmgr/services/e_service_softkey.c \ src/bin/windowmgr/services/e_service_taskbar.c \ src/bin/windowmgr/services/e_service_kvm.c \ src/bin/windowmgr/e_policy.c \ +src/bin/windowmgr/e_policy_zone.c \ +src/bin/windowmgr/e_policy_desk.c \ +src/bin/windowmgr/e_policy_desk_area.c \ src/bin/windowmgr/e_policy_stack.c \ src/bin/windowmgr/e_policy_visibility.c \ src/bin/windowmgr/e_policy_conformant.c \ diff --git a/src/bin/compmgr/e_comp_canvas.c b/src/bin/compmgr/e_comp_canvas.c index 6288d80d81..4239667347 100644 --- a/src/bin/compmgr/e_comp_canvas.c +++ b/src/bin/compmgr/e_comp_canvas.c @@ -12,9 +12,17 @@ #include "e_view_intern.h" #include "e_view_edje_intern.h" +#ifdef CONTAINER_POLICY +#include "e_policy_zone_intern.h" +#endif + static Eina_List *handlers; static Eina_Bool _ev_freeze = EINA_FALSE; +#ifdef CONTAINER_POLICY +static Eina_List *g_policy_zones; +#endif + static void _e_comp_canvas_render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -93,6 +101,9 @@ e_comp_canvas_init(int w, int h) int color[4] = {0, 0, 0, 255}; E_Zone *zone; E_Tizen_Screen *tizen_screen; +#ifdef CONTAINER_POLICY + E_Policy_Zone *policy_zone; +#endif TRACE_DS_BEGIN(COMP_CANVAS:INIT); @@ -139,6 +150,10 @@ e_comp_canvas_init(int w, int h) EINA_LIST_FOREACH(screens, l, scr) { zone = e_zone_screen_new(scr->screen, scr->w, scr->h); +#ifdef CONTAINER_POLICY + policy_zone = e_policy_zone_new(zone); + g_policy_zones = eina_list_append(g_policy_zones, policy_zone); +#endif tizen_screen = e_tizen_screen_create(zone); if (scr->id) zone->output_id = strdup(scr->id); printf("@@@ NEW ZONE = %p, %p\n", zone, tizen_screen); @@ -147,6 +162,10 @@ e_comp_canvas_init(int w, int h) else { zone = e_zone_screen_new(0, e_comp->w, e_comp->h); +#ifdef CONTAINER_POLICY + policy_zone = e_policy_zone_new(zone); + g_policy_zones = eina_list_append(g_policy_zones, policy_zone); +#endif tizen_screen = e_tizen_screen_create(zone); printf("@@@ NEW ZONE = %p, %p\n", zone, tizen_screen); } @@ -300,6 +319,9 @@ e_comp_canvas_update(void) E_Tizen_Screen *tizen_screen; E_Screen *scr; Eina_Bool changed = EINA_FALSE; +#ifdef CONTAINER_POLICY + E_Policy_Zone *policy_zone; +#endif screens = (Eina_List *)e_comp_screen_e_screens_get(e_comp_screen_get()); @@ -338,6 +360,10 @@ e_comp_canvas_update(void) else { zone = e_zone_screen_new(scr->screen, scr->w, scr->h); +#ifdef CONTAINER_POLICY + policy_zone = e_policy_zone_new(zone); + g_policy_zones = eina_list_append(g_policy_zones, policy_zone); +#endif tizen_screen = e_tizen_screen_create(zone); if (scr->id) zone->output_id = strdup(scr->id); diff --git a/src/bin/core/e_intern.h b/src/bin/core/e_intern.h index 2879366071..762e15756b 100644 --- a/src/bin/core/e_intern.h +++ b/src/bin/core/e_intern.h @@ -20,6 +20,8 @@ #include #include +#define CONTAINER_POLICY + #define CHECKING_PRIMARY_ZPOS #define CLIENT_DEL_STACK_ISSUE diff --git a/src/bin/windowmgr/e_policy.c b/src/bin/windowmgr/e_policy.c index 6318b06abb..885d231760 100644 --- a/src/bin/windowmgr/e_policy.c +++ b/src/bin/windowmgr/e_policy.c @@ -24,6 +24,10 @@ #include "e_policy_stack_intern.h" #include "e_compositor_intern.h" +#ifdef CONTAINER_POLICY +#include "e_policy_desk_intern.h" +#endif + E_Policy *e_policy = NULL; Eina_Hash *hash_policy_desks = NULL; Eina_Hash *hash_policy_clients = NULL; @@ -504,7 +508,11 @@ _e_policy_client_floating_policy_cancel(E_Policy_Client *pc) pc->flt_policy_state = EINA_FALSE; } +#ifdef CONTAINER_POLICY +EINTERN E_Config_Policy_Desk * +#else E_Config_Policy_Desk * +#endif _e_policy_desk_get_by_num(unsigned int zone_num, int x, int y) { Eina_List *l; @@ -2399,11 +2407,13 @@ EINTERN int e_policy_init(void) { E_Policy *pol; +#ifdef CONTAINER_POLICY +#else E_Zone *zone; E_Config_Policy_Desk *d; const Eina_List *l; int i, n; - +#endif pol = E_NEW(E_Policy, 1); EINA_SAFETY_ON_NULL_RETURN_VAL(pol, EINA_FALSE); @@ -2418,6 +2428,8 @@ e_policy_init(void) e_policy_wl_init(); e_policy_wl_aux_hint_init(); +#ifdef CONTAINER_POLICY +#else EINA_LIST_FOREACH(e_comp->zones, l, zone) { n = zone->desk_y_count * zone->desk_x_count; @@ -2435,6 +2447,7 @@ e_policy_init(void) e_policy_desk_add(zone->desks[i]); } } +#endif E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_ADD, _e_policy_cb_zone_add, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DEL, _e_policy_cb_zone_del, NULL); diff --git a/src/bin/windowmgr/e_policy_desk.c b/src/bin/windowmgr/e_policy_desk.c new file mode 100644 index 0000000000..247311a466 --- /dev/null +++ b/src/bin/windowmgr/e_policy_desk.c @@ -0,0 +1,8 @@ +#include "e_policy_desk_intern.h" + +#ifdef CONTAINER_POLICY + + + +#endif + diff --git a/src/bin/windowmgr/e_policy_desk_area.c b/src/bin/windowmgr/e_policy_desk_area.c new file mode 100644 index 0000000000..6a55cd8dee --- /dev/null +++ b/src/bin/windowmgr/e_policy_desk_area.c @@ -0,0 +1,10 @@ +#include "e_policy_desk_area_intern.h" + +#ifdef CONTAINER_POLICY + +struct _E_Policy_Desk_Area +{ + E_Desk_Area *desk_area; +}; + +#endif diff --git a/src/bin/windowmgr/e_policy_desk_area_intern.h b/src/bin/windowmgr/e_policy_desk_area_intern.h new file mode 100644 index 0000000000..f56a070f91 --- /dev/null +++ b/src/bin/windowmgr/e_policy_desk_area_intern.h @@ -0,0 +1,7 @@ +#ifndef E_POLICY_DESK_AREA_INTERN_H +#define E_POLICY_DESK_AREA_INTERN_H + +#include "e_intern.h" +#include "e_desk_area_intern.h" + +#endif diff --git a/src/bin/windowmgr/e_policy_desk_intern.h b/src/bin/windowmgr/e_policy_desk_intern.h new file mode 100644 index 0000000000..956d385b3d --- /dev/null +++ b/src/bin/windowmgr/e_policy_desk_intern.h @@ -0,0 +1,17 @@ +#ifndef E_POLICY_DESK_INTERN_H +#define E_POLICY_DESK_INTERN_H + +#include "e_intern.h" +#include "e_desk_intern.h" + +typedef struct _E_Policy_Desk E_Policy_Desk; + +#ifdef CONTAINER_POLICY +struct _E_Policy_Desk +{ + E_Desk *desk; + E_Zone *zone; +}; +#endif + +#endif diff --git a/src/bin/windowmgr/e_policy_intern.h b/src/bin/windowmgr/e_policy_intern.h index 3cff32ef05..fcd57f73d4 100644 --- a/src/bin/windowmgr/e_policy_intern.h +++ b/src/bin/windowmgr/e_policy_intern.h @@ -3,9 +3,15 @@ #include "e_intern.h" #include "e_policy.h" +#ifdef CONTAINER_POLICY +#include "e_policy_desk_intern.h" +#endif typedef struct _E_Policy E_Policy; +#ifdef CONTAINER_POLICY +#else typedef struct _E_Policy_Desk E_Policy_Desk; +#endif typedef struct _E_Policy_Client E_Policy_Client; typedef struct _E_Policy_System_Info E_Policy_System_Info; @@ -16,11 +22,14 @@ struct _E_Policy Eina_Inlist *softkeys; /* softkey ui object per zone */ }; +#ifdef CONTAINER_POLICY +#else struct _E_Policy_Desk { E_Desk *desk; E_Zone *zone; }; +#endif struct _E_Policy_Client { @@ -147,4 +156,8 @@ EINTERN void e_policy_keyboard_layout_apply(E_Client *ec); EINTERN void e_policy_interceptors_clean(void); EINTERN Eina_Bool e_policy_interceptor_call(E_Policy_Intercept_Point ipoint, E_Client *ec, ...); +#ifdef CONTAINER_POLICY +EINTERN E_Config_Policy_Desk *_e_policy_desk_get_by_num(unsigned int zone_num, int x, int y); +#endif + #endif diff --git a/src/bin/windowmgr/e_policy_zone.c b/src/bin/windowmgr/e_policy_zone.c new file mode 100644 index 0000000000..e1623ee59a --- /dev/null +++ b/src/bin/windowmgr/e_policy_zone.c @@ -0,0 +1,58 @@ +#include "e_policy_zone_intern.h" +#include "e_policy_intern.h" + +#ifdef CONTAINER_POLICY + +struct _E_Policy_Zone +{ + E_Zone *zone; + + struct wl_listener zone_destroy; +}; + +static void +_e_policy_zone_cb_zone_destroy(struct wl_listener *listener, void *data) +{ + E_Policy_Zone *policy_zone; + + policy_zone = wl_container_of(listener, policy_zone, zone_destroy); + + e_object_unref(E_OBJECT(policy_zone->zone)); + policy_zone->zone = NULL; +} + +EINTERN E_Policy_Zone * +e_policy_zone_new(E_Zone *zone) +{ + E_Policy_Zone *policy_zone; + E_Config_Policy_Desk *d; + int n, i; + + policy_zone = E_NEW(E_Policy_Zone, 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(policy_zone, NULL); + policy_zone->zone = zone; + e_object_ref(E_OBJECT(zone)); + + n = zone->desk_y_count * zone->desk_x_count; + for (i = 0; i < n; i++) + { + if (e_config->use_configured_desks) + { + d = _e_policy_desk_get_by_num(zone->num, + zone->desks[i]->x, + zone->desks[i]->y); + if (d) + e_policy_desk_add(zone->desks[i]); + } + else + e_policy_desk_add(zone->desks[i]); + } + + // zone listeners + policy_zone->zone_destroy.notify = _e_policy_zone_cb_zone_destroy; + e_zone_destroy_listener_add(zone, &policy_zone->zone_destroy); + + return policy_zone; +} + +#endif diff --git a/src/bin/windowmgr/e_policy_zone_intern.h b/src/bin/windowmgr/e_policy_zone_intern.h new file mode 100644 index 0000000000..b4887c1b40 --- /dev/null +++ b/src/bin/windowmgr/e_policy_zone_intern.h @@ -0,0 +1,11 @@ +#ifndef E_POLICY_ZONE_INTERN_H +#define E_POLICY_ZONE_INTERN_H + +#include "e_intern.h" +#include "e_zone_intern.h" + +typedef struct _E_Policy_Zone E_Policy_Zone; + +E_Policy_Zone *e_policy_zone_new(E_Zone *zone); + +#endif -- 2.34.1