e_client:base_output_resolution: Delete a transform which is applied by base_output_r... 96/211696/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 4 Jul 2019 04:25:00 +0000 (13:25 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Thu, 8 Aug 2019 07:39:45 +0000 (16:39 +0900)
Change-Id: Ie37e7450e4446ee2b7acd2e9d7bcd33bd0de7da7

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_comp_wl.h

index 763e1ad1568958c920615ccac3f1208f38b60470..721d3a11887e690eee2d2a430c0c33e955bcbb6f 100644 (file)
@@ -1223,6 +1223,7 @@ _e_client_del(E_Client *ec)
    e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
    e_util_transform_del(ec->base_output_resolution.transform);
    ec->base_output_resolution.transform = NULL;
+   E_FREE_FUNC(ec->base_output_resolution.hook_subsurf_create, e_comp_wl_hook_del);
 
    if (ec->transform_core.transform_list)
      {
@@ -3544,18 +3545,6 @@ _e_client_transform_core_check_change(E_Client *ec)
    Eina_Bool check = EINA_FALSE;
    if (!ec) return EINA_FALSE;
 
-   // wait viewport setting
-   if (!ec->transform_core.transform_list)
-     {
-        if (ec->comp_data && ec->comp_data->scaler.viewport)
-          {
-             if (!ec->comp_data->sub.below_list && !ec->comp_data->sub.below_list_pending)
-               {
-                  return EINA_FALSE;
-               }
-          }
-     }
-
    if (ec->frame)
      evas_object_geometry_get(ec->frame, 0, 0, &w, &h);
 
@@ -7320,6 +7309,35 @@ e_client_image_save(E_Client *ec, const char *dir, const char *name, E_Capture_C
    return e_comp_wl_capture_client_image_save(ec, dir, name, func_end, data, skip_child);
 }
 
+static void
+_e_client_base_output_resolution_hook_subsurf_create(void *data, E_Client *ec)
+{
+   E_Client *parent;
+
+   if (!ec->base_output_resolution.hook_subsurf_create)
+     return;
+
+   ec->base_output_resolution.use = 0;
+   ec->base_output_resolution.w = 0;
+   ec->base_output_resolution.h = 0;
+   e_client_transform_core_remove(ec, ec->base_output_resolution.transform);
+   E_FREE_FUNC(ec->base_output_resolution.transform, e_util_transform_del);
+   E_FREE_FUNC(ec->base_output_resolution.hook_subsurf_create, e_comp_wl_hook_del);
+
+   ELOGF("POL_APPINFO", "Cancel TRANSFORM for subsurface", ec);
+
+   /* Update transform for toplevel surface.
+    * The transform of subsurface will be updated by its parent accordingly. */
+   parent = e_comp_wl_topmost_parent_get(ec);
+   if (parent)
+     {
+        parent->transform_core.changed = EINA_TRUE;
+        e_client_transform_core_update(parent);
+     }
+
+   /* TODO: Do we need to apply it again if subsurface is destroyed? */
+}
+
 static void
 _e_client_base_output_resolution_set(E_Client *ec, int width, int height)
 {
@@ -7329,6 +7347,14 @@ _e_client_base_output_resolution_set(E_Client *ec, int width, int height)
    ec->base_output_resolution.h = height;
    ec->base_output_resolution.transform = e_util_transform_new();
    e_client_transform_core_add(ec, ec->base_output_resolution.transform);
+
+   if (!ec->base_output_resolution.hook_subsurf_create)
+     {
+        ec->base_output_resolution.hook_subsurf_create =
+           e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
+                              _e_client_base_output_resolution_hook_subsurf_create,
+                              NULL);
+     }
 }
 
 E_API void
@@ -7359,6 +7385,13 @@ e_client_base_output_resolution_update(E_Client *ec)
   if (!e_config->configured_output_resolution.use) return EINA_TRUE;
   if (ec->base_output_resolution.use) return EINA_TRUE;
 
+  /* Check whether it's subsurface or not
+   * The resolution of subsurface will follow the resolution of its toplevel surface.
+   * Transform for subsurface will be applied when toplevel surface does by
+   * implementation of e_client_transform_core.
+   */
+  if (ec->comp_data->sub.data) return EINA_FALSE;
+
   configured_width = e_config->configured_output_resolution.w;
   configured_height = e_config->configured_output_resolution.h;
 
index a17b5548f2662831fa115fe16f8e35075f3e36d9..cd7786d094aa0dcd52c7936bc138d278bf9f312d 100644 (file)
@@ -984,6 +984,7 @@ struct E_Client
       int          w;
       int          h;
       E_Util_Transform *transform;
+      E_Comp_Wl_Hook *hook_subsurf_create;
    } base_output_resolution;
 };
 
index e2d617be998b97a8a4839b32bba013d9f0b45203..3adbfb4115b012d583793a4d90af6f82087c256c 100644 (file)
@@ -1,4 +1,5 @@
 #ifdef E_TYPEDEFS
+typedef struct _E_Comp_Wl_Hook E_Comp_Wl_Hook;
 #else
 # ifndef E_COMP_WL_H
 #  define E_COMP_WL_H
@@ -44,7 +45,6 @@ typedef struct _E_Comp_Wl_Surface_State E_Comp_Wl_Surface_State;
 typedef struct _E_Comp_Wl_Client_Data E_Comp_Wl_Client_Data;
 typedef struct _E_Comp_Wl_Data E_Comp_Wl_Data;
 typedef struct _E_Comp_Wl_Output E_Comp_Wl_Output;
-typedef struct _E_Comp_Wl_Hook E_Comp_Wl_Hook;
 typedef struct _E_Comp_Wl_Intercept_Hook E_Comp_Wl_Intercept_Hook;