subsurface: Update position of comp object upon creation 43/309143/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 4 Apr 2024 02:01:21 +0000 (11:01 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 5 Apr 2024 06:01:41 +0000 (15:01 +0900)
Upon creation, the position of the comp object for a subsurface must be
updated to ensure that the subsurface is positioned correctly based on
its ancestral relationships. By doing so, the subsurface will be
accurately placed according to the translated positions of its ancestor
surfaces.

Change-Id: Ie9324ffe0ae04b8df728f915c353df258cc565db

src/bin/e_compositor.c

index 5c77fda..6731ba4 100644 (file)
@@ -91,6 +91,7 @@ static E_Subsurface *_e_subsurface_from_ds_subsurface(struct ds_subsurface *ds_s
 static void _e_subsurface_destroy(E_Subsurface *sub);
 static void _e_subsurface_commit(E_Subsurface *sub);
 static void _e_subsurface_place_below_parent(E_Subsurface *sub);
+static void _e_subsurface_position_update(E_Subsurface *sub);
 static void _e_subsurface_cb_destroy(struct wl_listener *listener, void *data);
 static void _e_subsurface_cb_cached(struct wl_listener *listener, void *data);
 static void _e_subsurface_cb_request_move(struct wl_listener *listener, void *data);
@@ -1339,6 +1340,8 @@ _e_subsurface_create(struct ds_subsurface *ds_subsurface, E_Surface *parent_surf
                                     epc,
                                     offscreen_parent);
 
+   _e_subsurface_position_update(sub);
+
    ELOGF("SUBSURFACE", "Create: parent(%p)", surface->ec, epc);
 
    return sub;
@@ -1439,9 +1442,8 @@ _e_subsurface_position_update(E_Subsurface *sub)
    E_Client *ec = sub->surface->ec;
    int x, y;
 
-   x = sub->base.parent->x + sub->base.position.x;
-   y = sub->base.parent->y + sub->base.position.y;
-   evas_object_move(ec->frame, x, y);
+   if (e_comp_wl_subsurface_global_coord_get(ec, &x, &y))
+     evas_object_move(ec->frame, x, y);
 }
 
 static void