e_foreign_shell: Update destination and transform of foreign shell 41/258741/1
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 25 May 2021 04:13:56 +0000 (13:13 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Tue, 25 May 2021 04:51:18 +0000 (13:51 +0900)
If foreign shell is newly created client and surface is committed,
then the state of foreign shell for not only visibility but also
destination size and transform has to be updated to the same of
exported shell's one.

Otherwise, the state of foreign shell can't be updated in forever until
the state of exported shell gets updated.

Change-Id: I953bafaf114bf86354fbfac25268e9364d8bd5c2

src/bin/e_foreign_shell.c

index e7decc5..884b255 100644 (file)
@@ -40,6 +40,8 @@ struct _E_Exported_Shell
    struct wl_listener surface_commit_listener;
    struct wl_signal destroy_signal;
 
+   int x, y;
+
    Eina_Bool has_cache_data;
 };
 
@@ -87,6 +89,7 @@ static void              _e_foreign_shell_transform_update(E_Foreign_Shell *fs);
 static void              _e_foreign_shell_viewport_update(E_Foreign_Shell *fs);
 static void              _e_foreign_shell_rotation_update(E_Foreign_Shell *fs);
 static void              _e_foreign_shell_place_under_exported(E_Foreign_Shell *fs);
+static void              _e_foreign_shell_state_sync_with_exported(E_Foreign_Shell *fs);
 static void              _e_foreign_shell_exported_restack_handler_add(E_Foreign_Shell *fs);
 static void              _e_foreign_shell_exported_restack_handler_remove(E_Foreign_Shell *fs);
 static void              _e_foreign_shell_exported_destroy_handler_add(E_Foreign_Shell *fs);
@@ -424,17 +427,20 @@ _e_exported_shell_cb_eo_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
 {
    E_Exported_Shell *es;
    E_Client *esc;
-   int x, y;
 
    es = data;
    esc = wl_resource_get_user_data(es->surface);
-   evas_object_geometry_get(esc->frame, &x, &y, NULL, NULL);
+   evas_object_geometry_get(esc->frame, &es->x, &es->y, NULL, NULL);
 
    if (es->foreign)
-     _e_foreign_shell_destination_set(es->foreign, x, y, es->stage.width, es->stage.height);
+     {
+        _e_foreign_shell_destination_set(es->foreign,
+                                         es->x, es->y,
+                                         es->stage.width, es->stage.height);
+     }
 
    e_util_transform_viewport_set(es->transform,
-                                 x, y,
+                                 es->x, es->y,
                                  es->stage.width,
                                  es->stage.height);
    e_client_transform_core_update(esc);
@@ -767,8 +773,8 @@ _e_foreign_shell_cb_surface_commit(struct wl_listener *listener, void *data EINA
 
    e_comp_wl_map_size_cal_from_buffer(fsc);
 
-   if ((fsc->new_client) && (fs->exported))
-     _e_foreign_shell_visible_set(fs, fs->exported->stage.map);
+   if (fsc->new_client)
+     _e_foreign_shell_state_sync_with_exported(fs);
 }
 
 /* TODO */
@@ -1124,3 +1130,18 @@ _e_foreign_shell_transform_set(E_Foreign_Shell *fs, enum wtz_exported_shell_tran
 
    wtz_foreign_shell_send_transform_changed(fs->resource, transform);
 }
+
+static void
+_e_foreign_shell_state_sync_with_exported(E_Foreign_Shell *fs)
+{
+   E_Exported_Shell *es;
+
+   es = fs->exported;
+   if (!es)
+     return;
+
+   _e_foreign_shell_visible_set(fs, es->stage.map);
+   _e_foreign_shell_destination_set(fs, es->x, es->y,
+                                    es->stage.width, es->stage.height);
+   _e_foreign_shell_transform_set(fs, es->stage.transform);
+}