e_comp_wl: set the configured_resolution of the e_comp_wl_output
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 23 Apr 2019 05:54:08 +0000 (14:54 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 23 Apr 2019 06:53:00 +0000 (15:53 +0900)
Now, the configured_resolution of the e_comp_wl_output is
the output resolution of the wl_output. Therefore, the server
has to calculate the size of output for the client with the
configured_resolution of the e_comp_wl_output.

Change-Id: Iad8c130916779b3a5a3e71ffabae6067aa55faea

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

index 08e70723379e94476905890bf7f055726ea35d6b..0e142969660d8fecc484949f42f48305f5abbf64 100644 (file)
@@ -4521,6 +4521,9 @@ _e_comp_wl_cb_output_bind(struct wl_client *client, void *data, uint32_t version
 {
    E_Comp_Wl_Output *output;
    struct wl_resource *resource;
+   E_Policy_Appinfo *epai = NULL;
+   pid_t pid = 0;
+   int res_w, res_h;
 
    if (!(output = data)) return;
 
@@ -4532,8 +4535,8 @@ _e_comp_wl_cb_output_bind(struct wl_client *client, void *data, uint32_t version
         return;
      }
 
-   DBG("Bound Output: %s", output->id);
-   DBG("\tGeom: %d %d %d %d", output->x, output->y, output->w, output->h);
+   ELOGF("COMP_WL", "Bound Output: %s", NULL, NULL, output->id);
+   ELOGF("COMP_WL", "\tOutput Geom: %d %d %d %d", NULL, NULL, output->x, output->y, output->w, output->h);
 
    output->resources = eina_list_append(output->resources, resource);
 
@@ -4549,8 +4552,48 @@ _e_comp_wl_cb_output_bind(struct wl_client *client, void *data, uint32_t version
    if (version >= WL_OUTPUT_SCALE_SINCE_VERSION)
      wl_output_send_scale(resource, output->scale);
 
-   /* 3 == preferred + current */
-   wl_output_send_mode(resource, 3, output->w, output->h, output->refresh);
+   // set the configured_output_resolution as a resolution of the wl_output if the use is set.
+   if (e_config->configured_output_resolution.use)
+     {
+        wl_client_get_credentials(client, &pid, NULL, NULL);
+        if (pid <= 0)
+          {
+             res_w = e_config->configured_output_resolution.w;
+             res_h = e_config->configured_output_resolution.h;
+             goto send_mode;
+          }
+
+        epai = e_policy_appinfo_find_with_pid(pid);
+        if (!epai)
+          {
+             res_w = e_config->configured_output_resolution.w;
+             res_h = e_config->configured_output_resolution.h;
+             goto send_mode;
+          }
+
+        if (!e_policy_appinfo_base_output_resolution_get(epai, &res_w, &res_h))
+          {
+             res_w = e_config->configured_output_resolution.w;
+             res_h = e_config->configured_output_resolution.h;
+             goto send_mode;
+          }
+
+        ELOGF("COMP_WL", "Get base_screen_resolution. (pid:%d).", NULL, NULL, pid);
+     }
+   else
+     {
+        res_w = output->w;
+        res_h = output->h;
+     }
+
+send_mode:
+   // change the configured_output_resolution of the output
+   // configured_output_resolution is the output resolution.
+   if (output->configured_resolution_w != res_w) output->configured_resolution_w = res_w;
+   if (output->configured_resolution_h != res_h) output->configured_resolution_h = res_h;
+
+   ELOGF("COMP_WL", "\tConfigured Output Resolution: %d, %d (pid:%d).", NULL, NULL, res_w, res_h, pid);
+   wl_output_send_mode(resource, 3, res_w, res_h, output->refresh);
 
    if (version >= WL_OUTPUT_DONE_SINCE_VERSION)
      wl_output_send_done(resource);
index 0b059aab2dcf01db8562046b702a195d1481c909..14d99e4d5e9a2bf798ed59c7f8c3d985ce9c49f2 100644 (file)
@@ -498,6 +498,10 @@ struct _E_Comp_Wl_Output
    struct wl_output *wl_output;
    struct wl_buffer *buffer;
    void *data;
+
+   /* configured_screen_resolution */
+   int configured_resolution_w;
+   int configured_resolution_h;
 };
 
 struct _E_Comp_Wl_Hook