e_comp_wl: add e_comp_wl_pid_output_configured_resolution_send 81/204381/5
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 23 Apr 2019 07:00:41 +0000 (16:00 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 26 Apr 2019 01:36:45 +0000 (01:36 +0000)
This function send the wl_output_send_mode with w,h paramter
when the size(w,h) is different with the existed configured resolution.

Change-Id: I043be9fc239054436b03aa87b8373110ccd243bc

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

index 47510d1001bccd8b00edeef2c0e4c4278d4c6490..0fe4c904b316ba21ce642886fd9d876feca4a7f1 100644 (file)
@@ -6716,3 +6716,53 @@ _e_comp_wl_move_resize_init(void)
 
    return;
 }
+
+EINTERN Eina_Bool
+e_comp_wl_pid_output_configured_resolution_send(pid_t pid, int w, int h)
+{
+   E_Comp_Wl_Output *output;
+   pid_t output_pid = 0;
+   Eina_List *l = NULL, *l2 = NULL;
+   struct wl_resource *resource = NULL;
+
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(pid <= 0, EINA_FALSE);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(w < 0, EINA_FALSE);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(h < 0, EINA_FALSE);
+
+   EINA_LIST_FOREACH(e_comp_wl->outputs, l, output)
+     {
+        /* if we have bound resources, send updates */
+        EINA_LIST_FOREACH(output->resources, l2, resource)
+          {
+             wl_client_get_credentials(wl_resource_get_client(resource), &output_pid, NULL, NULL);
+             if (output_pid != pid) continue;
+             if (output->configured_resolution_w == w && output->configured_resolution_h == h) continue;
+
+             wl_output_send_geometry(resource,
+                                     output->x, output->y,
+                                     output->phys_width,
+                                     output->phys_height,
+                                     output->subpixel,
+                                     output->make ?: "", output->model ?: "",
+                                     output->transform);
+
+             if (wl_resource_get_version(resource) >= WL_OUTPUT_SCALE_SINCE_VERSION)
+               wl_output_send_scale(resource, output->scale);
+
+             // change the configured_output_resolution of the output
+             // configured_output_resolution is the output resolution.
+             if (output->configured_resolution_w != w) output->configured_resolution_w = w;
+             if (output->configured_resolution_h != h) output->configured_resolution_h = h;
+
+             /* 3 == preferred + current */
+             wl_output_send_mode(resource, 3, w, h, output->refresh);
+
+             ELOGF("COMP_WL", "\tConfigured Output Resolution Again: %d, %d (pid:%d).", NULL, w, h, pid);
+
+             if (wl_resource_get_version(resource) >= WL_OUTPUT_DONE_SINCE_VERSION)
+               wl_output_send_done(resource);
+          }
+     }
+
+   return EINA_TRUE;
+}
\ No newline at end of file
index 98cd89407fb4c60bbbc8cf96b56dc620a327047c..f49ef1ba7887740cf36857171d70d2887b756eac 100644 (file)
@@ -604,5 +604,7 @@ E_API extern int E_EVENT_WAYLAND_GLOBAL_ADD;
 EINTERN Eina_Bool e_comp_wl_commit_sync_client_geometry_add(E_Client *ec, E_Client_Demand_Geometry mode, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h);
 EINTERN void e_comp_wl_trace_serial_debug(Eina_Bool on);
 EINTERN Eina_Bool e_comp_wl_commit_sync_configure(E_Client *ec);
+
+EINTERN Eina_Bool         e_comp_wl_pid_output_configured_resolution_send(pid_t pid, int w, int h);
 # endif
 #endif