e_client: add e_client_base_output_resolution_update
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 23 Apr 2019 07:25:04 +0000 (16:25 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 23 Apr 2019 07:31:55 +0000 (16:31 +0900)
This function updates the base_output_resolution of the ec.
The ec think that the output resolution of the ec is the size
of the base_output_resolution. Therefore, the buffer of the ec
has to be rendered with the transformation values.(scale up/down).

Change-Id: I746ca3e541f13b4e815532ff53de0ca395b8d228

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

index 17ffa1f4c72c1c22e8b88b21b741e4496a9e9e1e..4a4b10b13048d5a5d67e9bca28d274429e03ee6c 100644 (file)
@@ -1123,6 +1123,11 @@ _e_client_del(E_Client *ec)
      e_pixmap_client_set(ec->pixmap, NULL);
    ec->pixmap = NULL;
 
+   // base_output_resolution
+   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;
+
    if (ec->transform_core.transform_list)
      {
         E_Util_Transform *transform;
@@ -2140,10 +2145,21 @@ _e_client_maximize(E_Client *ec, E_Maximize max)
       case E_MAXIMIZE_EXPAND:
         if (ec->desk->visible)
           {
-             zx = ec->desk->geom.x;
-             zy = ec->desk->geom.y;
-             zw = ec->desk->geom.w;
-             zh = ec->desk->geom.h;
+             // base_output_resolution
+             if (ec->base_output_resolution.use)
+               {
+                  zx = ec->desk->geom.x;
+                  zy = ec->desk->geom.y;
+                  zw = ec->base_output_resolution.w;
+                  zh = ec->base_output_resolution.h;
+               }
+             else
+               {
+                  zx = ec->desk->geom.x;
+                  zy = ec->desk->geom.y;
+                  zw = ec->desk->geom.w;
+                  zh = ec->desk->geom.h;
+               }
           }
         else
           {
@@ -2255,6 +2271,18 @@ _e_client_maximize(E_Client *ec, E_Maximize max)
      }
    if (ec->maximize_override)
      ec->maximize_override = override;
+
+   // base_output_resolution
+   if (ec->base_output_resolution.use)
+     {
+        ELOGF("POL_APPINFO", "Apply TRANSFORM...1", ec->pixmap, ec);
+        e_util_transform_move(ec->base_output_resolution.transform, (double)ec->x, (double)ec->y, 0);
+        e_util_transform_scale(ec->base_output_resolution.transform,
+                               (double)ec->desk->geom.w /(double)ec->w,
+                               (double)ec->desk->geom.h /(double)ec->h,
+                               1.0);
+        e_client_transform_core_update(ec);
+     }
 }
 
 ////////////////////////////////////////////////
@@ -6990,6 +7018,65 @@ e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set)
    e_client_visibility_calculate();
 }
 
+static void
+_e_client_base_output_resolution_set(E_Client *ec, int width, int height)
+{
+   ec->base_output_resolution.use = 1;
+   ec->base_output_resolution.w = width;
+   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);
+}
+
+EINTERN Eina_Bool
+e_client_base_output_resolution_update(E_Client *ec)
+{
+   E_Policy_Appinfo *epai = NULL;
+   int configured_width, configured_height;
+   int width, height;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
+
+  if (!e_config->configured_output_resolution.use) return EINA_TRUE;
+  if (ec->base_output_resolution.use) return EINA_TRUE;
+
+  configured_width = e_config->configured_output_resolution.w;
+  configured_height = e_config->configured_output_resolution.h;
+
+  if (!ec->netwm.pid)
+    {
+       _e_client_base_output_resolution_set(ec, configured_width, configured_height);
+       ELOGF("POL_APPINFO", "NO PID... USE configured_output_resolution(%d,%d) pid:%d", ec->pixmap, ec,
+             configured_width, configured_height, ec->netwm.pid);
+       return EINA_TRUE;
+    }
+
+   epai = e_policy_appinfo_find_with_pid(ec->netwm.pid);
+   if (!epai)
+     {
+        _e_client_base_output_resolution_set(ec, configured_width, configured_height);
+        ELOGF("POL_APPINFO", "NO APPINFO... USE configured_output_resolution(%d,%d) pid:%d", ec->pixmap, ec,
+              configured_width, configured_height, ec->netwm.pid);
+        return EINA_TRUE;
+     }
+
+   if (!e_policy_appinfo_base_output_resolution_get(epai, &width, &height))
+     {
+        /* set the base_output_resolution of the e_client as a default */
+        _e_client_base_output_resolution_set(ec, configured_width, configured_height);
+        ELOGF("POL_APPINFO", "NO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) pid:%d", ec->pixmap, ec,
+              configured_width, configured_height, ec->netwm.pid);
+        return EINA_TRUE;
+      }
+
+   /* set the base_output_resolution of the e_client */
+   _e_client_base_output_resolution_set(ec, width, height);
+
+   ELOGF("POL_APPINFO", "USE base_output_resolution(%d,%d) pid:%d", ec->pixmap, ec, width, height, ec->netwm.pid);
+
+   return EINA_TRUE;
+}
+
 /* tizen_move_resize */
 EINTERN Eina_Bool
 e_client_pending_geometry_has(E_Client *ec)
index 19612275ec6d9203cc5ad59d77d9031282130496..bad04ee0656ff5c1b6578363f4ed8bab70eba57e 100644 (file)
@@ -969,6 +969,14 @@ struct E_Client
      } surface_sync;
 
    Eina_Bool on_render_list : 1; // client is on the render list
+
+   struct
+   {
+      Eina_Bool    use : 1; // use the base output resolution
+      int          w;
+      int          h;
+      E_Util_Transform *transform;
+   } base_output_resolution;
 };
 
 #define e_client_focus_policy_click(ec) \
@@ -1151,6 +1159,8 @@ E_API void e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set);
 
 E_API void e_client_stay_within_canvas_margin(E_Client *ec);
 
+EINTERN Eina_Bool e_client_base_output_resolution_update(E_Client *ec);
+
 EINTERN void e_client_revert_focus(E_Client *ec);
 EINTERN Eina_Bool e_client_check_above_focused(E_Client *ec);