From 0a931e834d2f56cbf2e4ba8c79d0469f9de80a15 Mon Sep 17 00:00:00 2001 From: Junseok Kim Date: Tue, 1 Apr 2025 19:48:01 +0900 Subject: [PATCH] e_zone: move bg object to policy_zone Change-Id: I5ff2130ac9cb4ab766e28849cfd9ba6132bfbd69 --- src/bin/core/e_zone.c | 56 ----------------------------- src/bin/windowmgr/e_policy_zone.c | 60 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 56 deletions(-) diff --git a/src/bin/core/e_zone.c b/src/bin/core/e_zone.c index f223f4f13d..db0345cf96 100644 --- a/src/bin/core/e_zone.c +++ b/src/bin/core/e_zone.c @@ -28,8 +28,6 @@ typedef struct _E_Zone_Private E_Zone_Private; struct _E_Zone_Private { E_Zone *zone; - E_View_Rect *bg_event_view_rect; - E_View_Rect *bg_clip_view_rect; struct { @@ -193,12 +191,6 @@ EINTERN E_Zone * e_zone_new(int num, int id, int x, int y, int w, int h) { E_Zone *zone; - E_Zone_Private *zone_priv; - E_View_Tree *layer_tree; - E_View_Rect *rect; - E_View *view; - int bg_clip_color[4] = {255, 255, 255, 255}; - int bg_event_color[4] = {0, 0, 0, 0}; char name[40]; @@ -211,8 +203,6 @@ e_zone_new(int num, int id, int x, int y, int w, int h) return NULL; } - zone_priv = PRI(zone); - zone->x = x; zone->y = y; zone->w = w; @@ -228,24 +218,6 @@ e_zone_new(int num, int id, int x, int y, int w, int h) snprintf(name, sizeof(name), "Zone %d", zone->num); zone->name = eina_stringshare_add(name); - layer_tree = e_canvas_layer_view_tree_get(e_comp_canvas_get(), E_CANVAS_LAYER_BG); - rect = e_view_rect_create(layer_tree, w, h, bg_clip_color); - zone_priv->bg_clip_view_rect = rect; - view = e_view_rect_view_get(rect); - e_view_name_set(view, "zone->bg_clip_view"); - e_view_pass_events_set(view, true); - e_view_position_set(view, x, y); - e_view_show(view); - - rect = e_view_rect_create(layer_tree, w, h, bg_event_color); - zone_priv->bg_event_view_rect = rect; - view = e_view_rect_view_get(rect); - e_view_name_set(view, "zone->bg_event_view"); - e_view_clip_set(view, e_view_rect_view_get(zone_priv->bg_clip_view_rect)); - e_view_pass_events_set(view, true); - e_view_position_set(view, x, y); - e_view_show(view); - e_object_del_attach_func_set(E_OBJECT(zone), _e_zone_object_del_attach); if (starting) return zone; @@ -282,7 +254,6 @@ e_zone_move(E_Zone *zone, int y) { int dx, dy; - E_View_Rect *bg_event_view_rect, *bg_clip_view_rect; E_OBJECT_CHECK(zone); E_OBJECT_TYPE_CHECK(zone, E_ZONE_TYPE); @@ -293,13 +264,6 @@ e_zone_move(E_Zone *zone, zone->x = x; zone->y = y; - bg_event_view_rect = PRI(zone)->bg_event_view_rect; - bg_clip_view_rect = PRI(zone)->bg_clip_view_rect; - - - e_view_position_set(e_view_rect_view_get(bg_event_view_rect), x, y); - e_view_position_set(e_view_rect_view_get(bg_clip_view_rect), x, y); - if (!e_zone_generic_event_emit(zone, E_EVENT_ZONE_MOVE_RESIZE)) ELOGF("ZONE", "Failed to add zone event, zone:%p", NULL, zone); @@ -326,9 +290,6 @@ e_zone_resize(E_Zone *zone, zone->w = w; zone->h = h; - e_view_rect_size_set(PRI(zone)->bg_event_view_rect, w, h); - e_view_rect_size_set(PRI(zone)->bg_clip_view_rect, w, h); - if (!e_zone_generic_event_emit(zone, E_EVENT_ZONE_MOVE_RESIZE)) ELOGF("ZONE", "Failed to add zone event, zone:%p", NULL, zone); @@ -346,7 +307,6 @@ e_zone_move_resize(E_Zone *zone, int h) { int dx, dy, dw, dh; - E_View_Rect *bg_event_view_rect, *bg_clip_view_rect; E_OBJECT_CHECK_RETURN(zone, EINA_FALSE); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, EINA_FALSE); @@ -363,14 +323,6 @@ e_zone_move_resize(E_Zone *zone, zone->w = w; zone->h = h; - bg_event_view_rect = PRI(zone)->bg_event_view_rect; - bg_clip_view_rect = PRI(zone)->bg_clip_view_rect; - - e_view_rect_size_set(bg_event_view_rect, w, h); - e_view_rect_size_set(bg_clip_view_rect, w, h); - e_view_position_set(e_view_rect_view_get(bg_event_view_rect), x, y); - e_view_position_set(e_view_rect_view_get(bg_clip_view_rect), x, y); - if (!e_zone_generic_event_emit(zone, E_EVENT_ZONE_MOVE_RESIZE)) ELOGF("ZONE", "Failed to add zone event, zone:%p", NULL, zone); @@ -632,8 +584,6 @@ e_zone_orientation_force_update_del(E_Zone *zone, E_Client *client) static void _e_zone_free(E_Zone *zone) { - E_View_Rect *bg_event_view_rect, *bg_clip_view_rect; - wl_signal_emit(&PRI(zone)->events.destroy, NULL); if(zone->focus) e_focus_del(zone->focus); @@ -643,12 +593,6 @@ _e_zone_free(E_Zone *zone) if (zone->name) eina_stringshare_del(zone->name); - bg_event_view_rect = PRI(zone)->bg_event_view_rect; - bg_clip_view_rect = PRI(zone)->bg_clip_view_rect; - - e_view_destroy(e_view_rect_view_get(bg_event_view_rect)); - e_view_destroy(e_view_rect_view_get(bg_clip_view_rect)); - _e_zone_private_finish(zone); free(zone); } diff --git a/src/bin/windowmgr/e_policy_zone.c b/src/bin/windowmgr/e_policy_zone.c index ae0d4be77d..94311e06c2 100644 --- a/src/bin/windowmgr/e_policy_zone.c +++ b/src/bin/windowmgr/e_policy_zone.c @@ -24,6 +24,7 @@ #include "e_policy_stack_intern.h" #include "e_policy_wl_intern.h" #include "e_policy_container_intern.h" +#include "e_view_rect.h" #define ZONE_EC_DATA_KEY "E_Zone_Client" @@ -34,6 +35,8 @@ struct _E_Policy_Zone E_Policy_Container container; E_Zone *zone; + E_View_Rect *bg_event_view_rect; + E_View_Rect *bg_clip_view_rect; Eina_Hash *clients_hash; Eina_List *desk_list; @@ -351,10 +354,17 @@ _e_policy_zone_cb_move(struct wl_listener *listener, void *data) E_Zone_Data_Move_Resize *move_resize_data = (E_Zone_Data_Move_Resize *) data; E_Policy_Zone *policy_zone; E_Zone *zone; + E_View *bg_event_view, *bg_clip_view; policy_zone = wl_container_of(listener, policy_zone, move); zone = policy_zone->zone; + bg_event_view = e_view_rect_view_get(policy_zone->bg_event_view_rect); + bg_clip_view = e_view_rect_view_get(policy_zone->bg_clip_view_rect); + + e_view_position_set(bg_event_view, zone->x, zone->y); + e_view_position_set(bg_clip_view, zone->x, zone->y); + e_zone_reconfigure_clients(zone, move_resize_data->dx, move_resize_data->dy, 0, 0); return; @@ -370,6 +380,9 @@ _e_policy_zone_cb_resize(struct wl_listener *listener, void *data) policy_zone = wl_container_of(listener, policy_zone, move); zone = policy_zone->zone; + e_view_rect_size_set(policy_zone->bg_event_view_rect, zone->w, zone->h); + e_view_rect_size_set(policy_zone->bg_clip_view_rect, zone->w, zone->h); + e_zone_reconfigure_clients(zone, 0, 0, move_resize_data->dw, move_resize_data->dh); return; @@ -381,10 +394,19 @@ _e_policy_zone_cb_move_resize(struct wl_listener *listener, void *data) E_Zone_Data_Move_Resize *move_resize_data = (E_Zone_Data_Move_Resize *) data; E_Policy_Zone *policy_zone; E_Zone *zone; + E_View *bg_event_view, *bg_clip_view; policy_zone = wl_container_of(listener, policy_zone, move); zone = policy_zone->zone; + bg_event_view = e_view_rect_view_get(policy_zone->bg_event_view_rect); + bg_clip_view = e_view_rect_view_get(policy_zone->bg_clip_view_rect); + + e_view_rect_size_set(policy_zone->bg_event_view_rect, zone->w, zone->h); + e_view_rect_size_set(policy_zone->bg_clip_view_rect, zone->w, zone->h); + e_view_position_set(bg_event_view, zone->x, zone->y); + e_view_position_set(bg_clip_view, zone->x, zone->y); + e_zone_reconfigure_clients(zone, move_resize_data->dx, move_resize_data->dy, move_resize_data->dw, move_resize_data->dh); return; @@ -1854,6 +1876,37 @@ e_policy_zone_view_tree_get(E_Policy_Zone *policy_zone) return e_policy_container_view_tree_get(container); } +static void +_e_policy_zone_bg_object_new(E_Policy_Zone *policy_zone) +{ + E_Zone *zone; + E_View_Tree *layer_tree; + E_View_Rect *rect; + E_View *view; + int bg_clip_color[4] = {255, 255, 255, 255}; + int bg_event_color[4] = {0, 0, 0, 0}; + + zone = policy_zone->zone; + layer_tree = e_policy_zone_view_tree_get(policy_zone); + + rect = e_view_rect_create(layer_tree, zone->w, zone->h, bg_clip_color); + policy_zone->bg_clip_view_rect = rect; + view = e_view_rect_view_get(rect); + e_view_name_set(view, "zone->bg_clip_view"); + e_view_pass_events_set(view, true); + e_view_position_set(view, zone->x, zone->y); + e_view_show(view); + + rect = e_view_rect_create(layer_tree, zone->w, zone->h, bg_event_color); + policy_zone->bg_event_view_rect = rect; + view = e_view_rect_view_get(rect); + e_view_name_set(view, "zone->bg_event_view"); + e_view_clip_set(view, e_view_rect_view_get(policy_zone->bg_clip_view_rect)); + e_view_pass_events_set(view, true); + e_view_position_set(view, zone->x, zone->y); + e_view_show(view); +} + EINTERN E_Policy_Zone * e_policy_zone_new(E_Zone *zone) { @@ -1871,6 +1924,7 @@ e_policy_zone_new(E_Zone *zone) policy_zone->clients_hash = eina_hash_pointer_new(NULL); policy_zone->zone = zone; e_object_ref(E_OBJECT(zone)); + _e_policy_zone_bg_object_new(policy_zone); // events wl_signal_init(&policy_zone->events.client_add); @@ -1984,6 +2038,7 @@ EINTERN void e_policy_zone_del(E_Policy_Zone *policy_zone) { E_Policy_Zone_Private_Client *zone_client; + E_View *bg_event_view, *bg_clip_view; Eina_Iterator *it; EINA_SAFETY_ON_NULL_RETURN(policy_zone); @@ -2038,6 +2093,11 @@ e_policy_zone_del(E_Policy_Zone *policy_zone) eina_hash_free(policy_zone->clients_hash); } + bg_event_view = e_view_rect_view_get(policy_zone->bg_event_view_rect); + bg_clip_view = e_view_rect_view_get(policy_zone->bg_clip_view_rect); + e_view_destroy(bg_event_view); + e_view_destroy(bg_clip_view); + e_policy_container_view_tree_shutdown(e_policy_container_get(policy_zone)); E_FREE(policy_zone); -- 2.34.1