e_comp: Add default zone and set default zone as first allocated zone
authorJunseok Kim <juns.kim@samsung.com>
Mon, 30 Dec 2024 04:59:14 +0000 (13:59 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 2 Jan 2025 06:51:57 +0000 (15:51 +0900)
Change-Id: I2179a6eb15935526394326ca08637441c7562758

src/bin/compmgr/e_comp.c
src/bin/compmgr/e_comp_intern.h
src/bin/e_comp_screen.c
src/bin/windowmgr/e_policy_zone.c
src/include/e_comp.h

index edd663b5510b986474ac0b59394152914b2ae895..b4162b9aebcdb334adfc61758a681135c5774dd1 100644 (file)
@@ -854,6 +854,28 @@ e_comp_zone_find(const char *output_id)
    return NULL;
 }
 
+EINTERN void
+e_comp_default_zone_set(E_Comp *comp, E_Zone *zone)
+{
+   EINA_SAFETY_ON_NULL_RETURN(comp);
+   EINA_SAFETY_ON_NULL_RETURN(zone);
+
+   ELOGF("COMP", "Changed default zone from ID:%d(%p) -> ID:%d(%p)", NULL,
+         e_zone_id_get(comp->default_zone), comp->default_zone, e_zone_id_get(zone), zone);
+   comp->default_zone = zone;
+}
+
+EINTERN E_Zone *
+e_comp_default_zone_get(E_Comp *comp)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(comp, NULL);
+
+   if (comp->default_zone)
+     return comp->default_zone;
+   else
+     return eina_list_data_get(e_comp->zones);
+}
+
 E_API Evas *
 e_comp_evas_get(void)
 {
index 6bc00906b208a2248a924afbd6fdd3e7633d0a26..6936d200b0463c58c6a2fec1f5967dee202a6a71 100644 (file)
@@ -37,6 +37,8 @@ EINTERN void          e_comp_post_update_purge(E_Client *ec);
 
 EINTERN Eina_Bool     e_comp_is_on_overlay(E_Client *ec);
 EINTERN E_Zone       *e_comp_zone_find(const char *output_id);
+EINTERN void          e_comp_default_zone_set(E_Comp *comp, E_Zone *zone);
+EINTERN E_Zone       *e_comp_default_zone_get(E_Comp *comp);
 
 EINTERN Eina_Bool     e_comp_socket_init(const char *name);
 
index 7b0479c70c5268a780f4cdd1862beb7bfba6c7e0..a3865bfe87080815a1893cdf36c9514de56f6f79 100644 (file)
@@ -696,9 +696,12 @@ static Eina_Bool
 _e_comp_screen_screen_policy_setup(void)
 {
    Eina_List *screens;
+   E_Comp *comp;
+   E_Zone *first_zone = NULL;
    E_Screen *scr;
    Eina_List *l;
 
+   comp = e_comp_get();
    e_policy_desk_init();
    e_policy_desk_area_init();
 
@@ -721,6 +724,8 @@ _e_comp_screen_screen_policy_setup(void)
                &scr->tizen_screen_destroy);
 
          if (scr->id) scr->zone->output_id = strdup(scr->id);
+         if (!first_zone) first_zone = scr->zone;
+
          printf("@@@ NEW ZONE = %p, %p\n", scr->zone, scr->tz_screen);
       }
 
@@ -728,6 +733,8 @@ _e_comp_screen_screen_policy_setup(void)
    E_LIST_HANDLER_APPEND(event_handlers, E_EVENT_ZONE_ADD, _e_comp_cb_zone_change, NULL);
    E_LIST_HANDLER_APPEND(event_handlers, E_EVENT_COMPOSITOR_ENABLE, _e_comp_cb_compositor_enabled, NULL);
 
+   e_comp_default_zone_set(comp, first_zone);
+
    return EINA_TRUE;
 }
 
index 31e93ba65a0a2b51ed35b08134845c45188a23ca..a888640d7298ebb4b4e6908675737e417caa138b 100644 (file)
@@ -813,8 +813,9 @@ _policy_zone_cb_client_eval_post_new_client(struct wl_listener *listener, void *
 {
    E_Policy_Zone_Client *zone_client;
    E_Policy_Zone *policy_zone;
-   E_Zone *zone;
+   E_Zone *default_zone, *zone;
    E_Client *ec;
+   E_Comp *comp;
    int tx, ty, tw, th;
    int nw, nh;
    int zx = 0, zy = 0, zw = 0, zh = 0;
@@ -823,6 +824,7 @@ _policy_zone_cb_client_eval_post_new_client(struct wl_listener *listener, void *
    policy_zone = zone_client->policy_zone;
    zone = policy_zone->zone;
    ec = zone_client->ec;
+   comp = e_comp_get();
 
    e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh);
    /* enforce wm size hints for initial sizing */
@@ -886,6 +888,14 @@ _policy_zone_cb_client_eval_post_new_client(struct wl_listener *listener, void *
         if ((!ec->re_manage) && ((ec->x != x) || (ec->y != y)))
           zone1 = e_comp_zone_xy_get(x, y);
 
+        if (!zone1)
+          {
+             default_zone = e_comp_default_zone_get(comp);
+             e_zone_useful_geometry_get(default_zone, &zx, &zy, &zw, &zh);
+             if (default_zone && E_INSIDE(x, y, zx, zy, zw, zh))
+               zone1 = default_zone;
+          }
+
         if (!zone1)
           {
              zone1 = e_comp_zone_xy_get(ec->x + (ec->w / 2), ec->y + (ec->h / 2));
@@ -962,16 +972,24 @@ _policy_zone_cb_client_focus_set(struct wl_listener *listener, void *data)
 static void
 _e_policy_zone_cb_hook_client_new_client_post(void *d, E_Client *ec)
 {
-   E_Zone *zone;
+   E_Comp *comp;
+   E_Zone *default_zone, *zone;
 
    EINA_SAFETY_ON_NULL_RETURN(ec);
 
    zone = (E_Zone *)d;
    EINA_SAFETY_ON_NULL_RETURN(zone);
 
-   // FIXME: A ec is set the current zone now.
-   //        We need to make a policy for the placement of the ec at the zone.
-   if (zone != e_zone_current_get()) return;
+   comp = e_comp_get();
+   default_zone = e_comp_default_zone_get(comp);
+   if (default_zone)
+     {
+        if (default_zone != zone) return;
+     }
+   else
+     {
+        if (e_zone_current_get() != zone) return;
+     }
 
    e_policy_client_add(ec);
    e_zone_client_add(zone, ec);
index 0ff03226a90e9a6324801173c680038682eaf5c7..5f141da73c3e085e41c7a8653173d5a4b6a6852f 100644 (file)
@@ -83,6 +83,7 @@ struct _E_Comp
    E_Canvas       *canvas;
    E_View         *bg_blank_view;
    Eina_List      *zones;
+   E_Zone         *default_zone;
    E_Pointer      *pointer;
    Eina_List *clients;
    unsigned int new_clients;