subsurface: Update position of comp object upon creation 55/309155/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 4 Apr 2024 02:01:21 +0000 (11:01 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Fri, 5 Apr 2024 06:46:29 +0000 (15:46 +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: Ifbb8c6254da06c9086a933657158f11bf12094b6

src/bin/e_compositor.c

index 8e09ecac6e548a08087e583f4d97acee1e99920f..7b41090ec4345d6cd487ae21b4607225ce095090 100644 (file)
@@ -82,6 +82,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);
@@ -1333,6 +1334,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;
@@ -1430,9 +1433,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