e_info: add subsurface option to get subsurface information 02/87402/4
authorBoram Park <boram1288.park@samsung.com>
Wed, 7 Sep 2016 04:46:18 +0000 (13:46 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Mon, 12 Sep 2016 11:17:14 +0000 (04:17 -0700)
Change-Id: Iffc3effea16cf437a4f3727448dbe9f9b4c511f1

src/bin/e_comp_object.c
src/bin/e_comp_object.h
src/bin/e_info_client.c
src/bin/e_info_server.c
src/bin/e_info_shared_types.h

index 435226f..02eb625 100644 (file)
@@ -4592,6 +4592,14 @@ e_comp_object_alpha_set(Evas_Object *obj, Eina_Bool alpha)
      evas_object_image_data_set(cw->obj, NULL);
 }
 
+E_API Eina_Bool
+e_comp_object_alpha_get(Evas_Object *obj)
+{
+   API_ENTRY EINA_FALSE;
+
+   return evas_object_image_alpha_get(cw->obj);
+}
+
 E_API void
 e_comp_object_mask_set(Evas_Object *obj, Eina_Bool set)
 {
@@ -4632,6 +4640,14 @@ e_comp_object_mask_set(Evas_Object *obj, Eina_Bool set)
      }
 }
 
+E_API Eina_Bool
+e_comp_object_mask_has(Evas_Object *obj)
+{
+   API_ENTRY EINA_FALSE;
+
+   return (cw->mask_obj) ? EINA_TRUE : EINA_FALSE;
+}
+
 E_API void
 e_comp_object_size_update(Evas_Object *obj, int w, int h)
 {
index 1c6dcd1..d86dc25 100644 (file)
@@ -123,7 +123,9 @@ E_API void e_comp_object_intercept_hook_del(E_Comp_Object_Intercept_Hook *ch);
 #endif
 E_API unsigned int e_comp_object_is_animating(Evas_Object *obj);
 E_API void e_comp_object_alpha_set(Evas_Object *obj, Eina_Bool alpha);
+E_API Eina_Bool e_comp_object_alpha_get(Evas_Object *obj);
 E_API void e_comp_object_mask_set(Evas_Object *obj, Eina_Bool set);
+E_API Eina_Bool e_comp_object_mask_has(Evas_Object *obj);
 E_API void e_comp_object_size_update(Evas_Object *obj, int w, int h);
 E_API void e_comp_object_transform_bg_set(Evas_Object *obj, Eina_Bool set);
 E_API void e_comp_object_transform_bg_vertices_set(Evas_Object *obj, E_Util_Transform_Rect_Vertex *vertices);
index bfa1ae4..5513189 100644 (file)
@@ -659,6 +659,79 @@ _e_info_client_proc_topvwins_shot(int argc, char **argv)
 }
 
 static void
+_cb_subsurface_info_get(const Eldbus_Message *msg)
+{
+   const char *name = NULL, *text = NULL;
+   Eldbus_Message_Iter *array, *ec;
+   Eina_Bool res;
+   int count = 0;
+
+   res = eldbus_message_error_get(msg, &name, &text);
+   EINA_SAFETY_ON_TRUE_GOTO(res, finish);
+
+   res = eldbus_message_arguments_get(msg, "a("SIGNATURE_SUBSURFACE")", &array);
+   EINA_SAFETY_ON_FALSE_GOTO(res, finish);
+
+   printf("--------------------------------------[ subsurfaces ]---------------------------------------------------\n");
+   printf(" No     Win_ID  Parent_ID  Buf_ID    w    h    x    y Rot(f) Visi Alph Igno Mask Video   BgRect   Title\n");
+   printf("--------------------------------------------------------------------------------------------------------\n");
+
+   while (eldbus_message_iter_get_and_next(array, 'r', &ec))
+     {
+        Ecore_Window win = 0, parent = 0, bgrect = 0;
+        unsigned int buf_id = 0;
+        int x = 0, y = 0, w = 0, h = 0;
+        unsigned int transform = 0, visible = 0, alpha = 0, ignore = 0, maskobj = 0, video = 0;
+        const char *name = NULL;
+        char temp[128] = {0,};
+
+        res = eldbus_message_iter_arguments_get(ec,
+                                                SIGNATURE_SUBSURFACE,
+                                                &win, &parent,
+                                                &buf_id, &x, &y, &w, &h, &transform,
+                                                &visible, &alpha, &ignore, &maskobj, &video, &bgrect, &name);
+        if (!res)
+          {
+             printf("Failed to get win info\n");
+             continue;
+          }
+
+        count++;
+
+        printf("%3d 0x%08x ", count, win);
+        temp[0] = '\0';
+        if (parent > 0) snprintf(temp, sizeof(temp), "0x%08x", parent);
+        printf("%10s", temp);
+        temp[0] = '\0';
+        if (buf_id != 0)
+          snprintf(temp, sizeof(temp), "%5u%c",
+                   buf_id & (~WAYLAND_SERVER_RESOURCE_ID_MASK),
+                   (buf_id & WAYLAND_SERVER_RESOURCE_ID_MASK) ? 's' : 'c');
+        printf("  %6s", temp);
+        printf(" %4d %4d %4d %4d %3d(%d) %4s %4s %4s %4s %4s  ",
+               w, h, x, y, (4 - (transform & 3)) * 90 % 360, (transform & 4) ? 1 : 0,
+               (visible)?"O":"", (alpha)?"O":"", (ignore)?"O":"", (maskobj)?"O":"", (video)?"O":"");
+        temp[0] = '\0';
+        if (bgrect > 0) snprintf(temp, sizeof(temp), "0x%08x", bgrect);
+        printf("%10s", temp);
+        printf(" %s\n", name);
+     }
+
+   if (!count)
+     printf("no subsurface\n");
+
+finish:
+   if ((name) || (text))
+     printf("errname:%s errmsg:%s\n", name, text);
+}
+
+static void
+_e_info_client_proc_subsurface(int argc, char **argv)
+{
+   _e_info_client_eldbus_message("subsurface", _cb_subsurface_info_get);
+}
+
+static void
 _e_info_client_proc_eina_log_levels(int argc, char **argv)
 {
    EINA_SAFETY_ON_FALSE_RETURN(argc == 3);
@@ -1778,6 +1851,11 @@ static struct
       _e_info_client_proc_topvwins_info
    },
    {
+      "subsurface", NULL,
+      "Print subsurface information",
+      _e_info_client_proc_subsurface
+   },
+   {
       "dump_topvwins", "[directory_path]",
       "Dump top-level visible windows (default directory_path : current working directory)",
       _e_info_client_proc_topvwins_shot
index 6073dc3..a8bc072 100644 (file)
@@ -710,6 +710,94 @@ _e_info_server_cb_topvwins_dump(const Eldbus_Service_Interface *iface EINA_UNUSE
    return reply;
 }
 
+/* Method Handlers */
+static Eldbus_Message *
+_e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+   Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
+   Eldbus_Message_Iter *array_of_ec;
+   E_Client *ec;
+   Evas_Object *o;
+
+   eldbus_message_iter_arguments_append(iter, "a("SIGNATURE_SUBSURFACE")", &array_of_ec);
+
+   // append clients.
+   for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
+     {
+        Eldbus_Message_Iter* struct_of_ec;
+        Ecore_Window win = 0, parent = 0;
+        unsigned int buf_id = 0;
+        int x = 0, y = 0, w = 0, h = 0;
+        unsigned int transform = 0, visible = 0, alpha = 0, ignore = 0, maskobj = 0, video = 0;
+        Ecore_Window bgrect = 0;
+        const char *name = NULL;
+        E_Comp_Wl_Buffer *buffer;
+        const Evas_Map *map;
+
+        ec = evas_object_data_get(o, "E_Client");
+        if (!ec)
+          {
+             if (!evas_object_visible_get(o)) continue;
+
+             name = evas_object_name_get(o);
+             if (!name) continue;
+             if (strncmp(name, "below_bg_rectangle", 18)) continue;
+             win = (Ecore_Window)o;
+             evas_object_geometry_get(o, &x, &y, &w, &h);
+             visible = evas_object_visible_get(o);
+          }
+        else
+          {
+             if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) continue;
+             if (!ec->comp_data->sub.data &&
+                 !ec->comp_data->sub.list && !ec->comp_data->sub.list_pending &&
+                 !ec->comp_data->sub.below_list && !ec->comp_data->sub.below_list_pending)
+               continue;
+             win = e_client_util_win_get(ec);
+             if (ec->comp_data->sub.data)
+               parent = e_client_util_win_get(ec->comp_data->sub.data->parent);
+             buffer = e_pixmap_resource_get(ec->pixmap);
+             if (buffer)
+               buf_id = (buffer->resource) ? wl_resource_get_id(buffer->resource) : (WAYLAND_SERVER_RESOURCE_ID_MASK & 99999);
+             map = evas_object_map_get(ec->frame);
+             if (map)
+               {
+                  Evas_Coord x1, x2, y1, y2;
+                  E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport;
+                  evas_map_point_coord_get(map, 0, &x1, &y1, NULL);
+                  evas_map_point_coord_get(map, 2, &x2, &y2, NULL);
+                  x = x1, y = y1, w = x2 - x1, h = y2 - y1;
+                  transform = vp->buffer.transform;
+               }
+             else
+               evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
+             visible = evas_object_visible_get(o);
+             alpha = e_comp_object_alpha_get(ec->frame);
+             ignore = e_client_util_ignored_get(ec);
+             if (ec->comp_data->sub.below_obj)
+               bgrect = (Ecore_Window)ec->comp_data->sub.below_obj;
+             maskobj = e_comp_object_mask_has(ec->frame);
+             video = (ec->comp_data->video_client) ? 1 : 0;
+             name = e_client_util_name_get(ec);
+             if (!name)
+               name = "NO NAME";
+          }
+
+        eldbus_message_iter_arguments_append(array_of_ec, "("SIGNATURE_SUBSURFACE")", &struct_of_ec);
+
+        eldbus_message_iter_arguments_append
+           (struct_of_ec, SIGNATURE_SUBSURFACE,
+            win, parent, buf_id, x, y, w, h, transform, visible, alpha, ignore, maskobj, video, bgrect, name);
+
+        eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
+     }
+
+   eldbus_message_iter_container_close(iter, array_of_ec);
+
+   return reply;
+}
+
 static Eldbus_Message *
 _e_info_server_cb_eina_log_levels(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
 {
@@ -1952,6 +2040,7 @@ e_info_server_cb_aux_message(const Eldbus_Service_Interface *iface EINA_UNUSED,
 
 static const Eldbus_Method methods[] = {
    { "get_window_info", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
+   { "subsurface", NULL, ELDBUS_ARGS({"a("SIGNATURE_SUBSURFACE")", "array of ec"}), _e_info_server_cb_subsurface, 0 },
    { "dump_topvwins", ELDBUS_ARGS({"s", "directory"}), NULL, _e_info_server_cb_topvwins_dump, 0 },
    { "eina_log_levels", ELDBUS_ARGS({"s", "eina log levels"}), NULL, _e_info_server_cb_eina_log_levels, 0 },
    { "eina_log_path", ELDBUS_ARGS({"s", "eina log path"}), NULL, _e_info_server_cb_eina_log_path, 0 },
index 6778907..5dde6b7 100644 (file)
@@ -75,5 +75,10 @@ typedef enum
    E_INFO_CMD_MESSAGE_START,
 } E_Info_Slot_Message;
 
+/* -------------------------------------------------------------------------- */
+/* SUBSURFACE                                                                 */
+/* -------------------------------------------------------------------------- */
+#define SIGNATURE_SUBSURFACE "uuuiiiiuuuuuuus"
+#define WAYLAND_SERVER_RESOURCE_ID_MASK 0xff000000
 
 #endif /* end of _E_INFO_SHARED_TYPES_ */