e_pixmap: wl client pixmaps now use a different method for creating the pixmap id 83/43983/2 accepted/tizen/mobile/20150717.055854 accepted/tizen/tv/20150717.055904 accepted/tizen/wearable/20150717.055911 submit/tizen/20150717.004539
authorDuna Oh <duna.oh@samsung.com>
Thu, 16 Jul 2015 02:14:06 +0000 (11:14 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Thu, 16 Jul 2015 06:11:32 +0000 (23:11 -0700)
Applied this commit
 1. https://git.enlightenment.org/core/enlightenment.git/commit/?id=96f07bff8ae46ff5a0daff726aafaa86bd0ef8d4
 -> wl client pixmaps now use a different method for creating the pixmap id
 2. https://git.enlightenment.org/core/enlightenment.git/commit/?id=bb77ddf22c21a879755674321765f61d9f0ec406
 -> correctly apply wl shell client border states only for non-internal clients

enlightenment_info : add items shown on list - win_id, resource_id, and pid

Change-Id: Iacab3fec81d8b8bb4b9d20400c6eb67b0ef0ef0a
Signed-off-by: Duna Oh <duna.oh@samsung.com>
src/bin/e_client.h
src/bin/e_comp_wl.c
src/bin/e_comp_wl.h
src/bin/e_comp_wl_input.c
src/bin/e_info_client.c
src/bin/e_info_server.c
src/bin/e_pixmap.c
src/bin/e_pixmap.h
src/bin/e_win.c
src/modules/wl_desktop_shell/e_mod_main.c

index d2afd7a..02a65a9 100644 (file)
@@ -371,7 +371,7 @@ struct E_Client
       double                    min_aspect, max_aspect;
       Ecore_Window            icon_window;
       Ecore_Window            window_group;
-      uint64_t                transient_for;
+      Ecore_Window            transient_for;
       Ecore_Window            client_leader;
 #ifndef HAVE_WAYLAND_ONLY
       Ecore_X_Window_State_Hint initial_state;
index 52c26a5..6d76ea9 100644 (file)
@@ -1835,8 +1835,7 @@ _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_reso
 {
    E_Comp *comp;
    struct wl_resource *res;
-   E_Pixmap *ep;
-   uint64_t win;
+   E_Pixmap *ep = NULL;
    pid_t pid;
 
    if (!(comp = wl_resource_get_user_data(resource))) return;
@@ -1859,12 +1858,12 @@ _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_reso
                                   _e_comp_wl_surface_destroy);
 
    wl_client_get_credentials(client, &pid, NULL, NULL);
-   win = e_comp_wl_id_get(id, pid);
-   /* check for existing pixmap */
-   if (!(ep = e_pixmap_find(E_PIXMAP_TYPE_WL, win)))
+   if (pid == getpid()) //internal!
+     ep = e_pixmap_find(E_PIXMAP_TYPE_WL, (uintptr_t)id);
+   if (!ep)
      {
         /* try to create new pixmap */
-        if (!(ep = e_pixmap_new(E_PIXMAP_TYPE_WL, win)))
+        if (!(ep = e_pixmap_new(E_PIXMAP_TYPE_WL, res)))
           {
              ERR("Could not create new pixmap");
              wl_resource_destroy(res);
@@ -1872,8 +1871,7 @@ _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_reso
              return;
           }
      }
-
-   DBG("\tUsing Pixmap: %d", id);
+   DBG("\tUsing Pixmap: %p", ep);
 
    /* set reference to pixmap so we can fetch it later */
    wl_resource_set_user_data(res, ep);
@@ -2531,7 +2529,7 @@ _e_comp_wl_subcompositor_cb_bind(struct wl_client *client, void *data, uint32_t
 static void
 _e_comp_wl_client_cb_new(void *data EINA_UNUSED, E_Client *ec)
 {
-   uint64_t win;
+   Ecore_Window win;
 
    /* make sure this is a wayland client */
    if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
@@ -2664,7 +2662,7 @@ _e_comp_wl_client_cb_post_new(void *data EINA_UNUSED, E_Client *ec)
 static void
 _e_comp_wl_client_cb_pre_frame(void *data EINA_UNUSED, E_Client *ec)
 {
-   uint64_t parent;
+   Ecore_Window parent;
 
    if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
    if (!ec->comp_data->need_reparent) return;
index e095c38..4d13fe6 100644 (file)
@@ -362,11 +362,5 @@ EAPI struct wl_signal e_comp_wl_surface_create_signal_get(E_Comp *comp);
 EAPI double e_comp_wl_idle_time_get(void);
 EAPI void e_comp_wl_output_init(const char *id, const char *make, const char *model, int x, int y, int w, int h, int pw, int ph, unsigned int refresh, unsigned int subpixel, unsigned int transform);
 
-static inline uint64_t
-e_comp_wl_id_get(uint32_t id, pid_t pid)
-{
-   return ((uint64_t)id << 32) + pid;
-}
-
 # endif
 #endif
index 0f9a364..873d88e 100644 (file)
@@ -55,7 +55,6 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
    E_Comp_Data *cdata;
    pid_t pid;
    E_Client *ec;
-   uint64_t sid;
    Eina_Bool got_mouse = EINA_FALSE;
    int cursor_w = 0, cursor_h = 0;
 
@@ -77,13 +76,12 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
         e_pointer_object_set(e_comp->pointer, NULL, x, y);
         return;
      }
-   wl_client_get_credentials(client, &pid, NULL, NULL);
-   sid = e_comp_wl_id_get(wl_resource_get_id(surface_resource), pid);
-   if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, sid)))
+   if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, (uintptr_t)surface_resource)))
      {
         Eina_List *l;
 
-        ec = e_client_new(NULL, e_pixmap_new(E_PIXMAP_TYPE_WL, sid), 1, 0);
+        ec = e_client_new(NULL, e_pixmap_new(E_PIXMAP_TYPE_WL, surface_resource), 1, 0);
+        if (!ec) return;
         ec->lock_focus_out = ec->layer_block = ec->visible = ec->override = 1;
         ec->new_client = 0;
         e_comp->new_clients--;
index fcb174f..825aa7b 100644 (file)
@@ -18,7 +18,9 @@ typedef struct _E_Info_Client
 
 typedef struct _E_Win_Info
 {
-   uint64_t     id;         // native window id
+   Ecore_Window     id;         // native window id
+   uint32_t      res_id;
+   int           pid;
    const char  *name;       // name of client window
    int          x, y, w, h; // geometry
    int          layer;      // value of E_Layer
@@ -32,7 +34,7 @@ static Eina_Bool _e_info_client_eldbus_message(const char *method, E_Info_Messag
 static Eina_Bool _e_info_client_eldbus_message_with_args(const char *method, E_Info_Message_Cb cb, const char *signature, ...);
 
 static E_Win_Info *
-_e_win_info_new(Ecore_Window id, Eina_Bool alpha, const char *name, int x, int y, int w, int h, int layer, int visible)
+_e_win_info_new(Ecore_Window id, uint32_t res_id, int pid, Eina_Bool alpha, const char *name, int x, int y, int w, int h, int layer, int visible)
 {
    E_Win_Info *win = NULL;
 
@@ -40,6 +42,8 @@ _e_win_info_new(Ecore_Window id, Eina_Bool alpha, const char *name, int x, int y
    EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
 
    win->id = id;
+   win->res_id = res_id;
+   win->pid = pid;
    win->name = eina_stringshare_add(name);
    win->x = x;
    win->y = y;
@@ -73,7 +77,7 @@ _cb_window_info_get(const Eldbus_Message *msg)
    res = eldbus_message_error_get(msg, &name, &text);
    EINA_SAFETY_ON_TRUE_GOTO(res, finish);
 
-   res = eldbus_message_arguments_get(msg, "a(usiiiiibb)", &array);
+   res = eldbus_message_arguments_get(msg, "a(uuisiiiiibb)", &array);
    EINA_SAFETY_ON_FALSE_GOTO(res, finish);
 
    while (eldbus_message_iter_get_and_next(array, 'r', &ec))
@@ -82,10 +86,14 @@ _cb_window_info_get(const Eldbus_Message *msg)
         int x, y, w, h, layer;
         Eina_Bool visible, alpha;
         Ecore_Window id;
+        uint32_t res_id;
+        int pid;
         E_Win_Info *win = NULL;
         res = eldbus_message_iter_arguments_get(ec,
-                                                "usiiiiibb",
+                                                "uuisiiiiibb",
                                                 &id,
+                                                &res_id,
+                                                &pid,
                                                 &win_name,
                                                 &x,
                                                 &y,
@@ -100,7 +108,7 @@ _cb_window_info_get(const Eldbus_Message *msg)
              continue;
           }
 
-        win = _e_win_info_new(id, alpha, win_name, x, y, w, h, layer, visible);
+        win = _e_win_info_new(id, res_id, pid, alpha, win_name, x, y, w, h, layer, visible);
         e_info_client.win_list = eina_list_append(e_info_client.win_list, win);
      }
 
@@ -122,9 +130,9 @@ _e_info_client_proc_topvwins_info(int argc, char **argv)
      return;
 
    printf("%d Top level windows\n", eina_list_count(e_info_client.win_list));
-   printf("-------------------------[ topvwins ]------------------------------\n");
-   printf("No   PID     w     h     x     y   Depth         Title    map state\n");
-   printf("-------------------------------------------------------------------\n");
+   printf("--------------------------------------[ topvwins ]-----------------------------------------------------\n");
+   printf("No   Win_ID   Resource_ID   PID     w     h       x     y   Depth            Title              map_state\n");
+   printf("-------------------------------------------------------------------------------------------------------\n");
 
    if (!e_info_client.win_list)
      {
@@ -136,8 +144,8 @@ _e_info_client_proc_topvwins_info(int argc, char **argv)
      {
         if (!win) return;
         i++;
-        printf("%3d %"PRIu64" %5d %5d %5d %5d %5d ", i, win->id, win->w, win->h, win->x, win->y, win->alpha? 32:24);
-        printf("%15s %11s\n", win->name?:"No Name", win->vis? "Viewable":"NotViewable");
+        printf("%3d 0x%08x    %5d    %5d   %5d %5d %5d %5d %5d  ", i, win->id, win->res_id, win->pid, win->w, win->h, win->x, win->y, win->alpha? 32:24);
+        printf("%30s %11s\n", win->name?:"No Name", win->vis? "Viewable":"NotViewable");
      }
 
    E_FREE_LIST(e_info_client.win_list, _e_win_info_free);
index 85ccb5a..8b7e201 100644 (file)
@@ -34,13 +34,15 @@ _msg_clients_append(Eldbus_Message_Iter *iter)
    E_Client *ec;
    Evas_Object *o;
 
-   eldbus_message_iter_arguments_append(iter, "a(usiiiiibb)", &array_of_ec);
+   eldbus_message_iter_arguments_append(iter, "a(uuisiiiiibb)", &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;
+        uint32_t res_id;
+        pid_t pid;
 
         ec = evas_object_data_get(o, "E_Client");
         if (!ec) continue;
@@ -48,11 +50,23 @@ _msg_clients_append(Eldbus_Message_Iter *iter)
 
         win = e_client_util_win_get(ec);
 
-        eldbus_message_iter_arguments_append(array_of_ec, "(usiiiiibb)", &struct_of_ec);
+        if (ec->pixmap)
+          res_id = e_pixmap_res_id_get(ec->pixmap);
+#ifdef HAVE_WAYLAND_ONLY
+        if (ec->comp_data)
+          {
+             E_Comp_Wl_Client_Data *cdata = ec->comp_data;
+             if (cdata->surface)
+               wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
+          }
+#endif
+        eldbus_message_iter_arguments_append(array_of_ec, "(uuisiiiiibb)", &struct_of_ec);
 
         eldbus_message_iter_arguments_append
-           (struct_of_ec, "usiiiiibb",
+           (struct_of_ec, "uuisiiiiibb",
             win,
+            res_id,
+            pid,
             e_client_util_name_get(ec) ?: "NO NAME",
             ec->x, ec->y, ec->w, ec->h, ec->layer,
             ec->visible, ec->argb);
@@ -91,7 +105,7 @@ _e_info_server_cb_topvwins_dump(const Eldbus_Service_Interface *iface EINA_UNUSE
      {
         E_Client *ec = evas_object_data_get(o, "E_Client");
         char fname[PATH_MAX];
-        uint64_t win;
+        Ecore_Window win;
         void *data = NULL;
         int w = 0, h = 0;
         Ecore_Evas *ee = NULL;
@@ -101,7 +115,7 @@ _e_info_server_cb_topvwins_dump(const Eldbus_Service_Interface *iface EINA_UNUSE
         if (e_client_util_ignored_get(ec)) continue;
 
         win = e_client_util_win_get(ec);
-        snprintf(fname, sizeof(fname), "%s/%llu.png", dir, win);
+        snprintf(fname, sizeof(fname), "%s/0x%08x.png", dir, win);
 
 #ifdef HAVE_WAYLAND_ONLY
         E_Comp_Wl_Buffer *buffer = e_pixmap_resource_get(ec->pixmap);
@@ -240,7 +254,7 @@ _e_info_server_cb_eina_log_path(const Eldbus_Service_Interface *iface EINA_UNUSE
 }
 
 static const Eldbus_Method methods[] = {
-   { "get_window_info", NULL, ELDBUS_ARGS({"a(usiiiiibb)", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
+   { "get_window_info", NULL, ELDBUS_ARGS({"a(uuisiiiiibb)", "array of ec"}), _e_info_server_cb_window_info_get, 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 4e675e1..570d55d 100644 (file)
@@ -21,7 +21,7 @@ struct _E_Pixmap
    E_Client *client;
    E_Pixmap_Type type;
 
-   uint64_t win;
+   Ecore_Window win;
    uint32_t res_id;
    Ecore_Window parent;
 
@@ -174,7 +174,7 @@ _e_pixmap_find(E_Pixmap_Type type, va_list *l)
    Ecore_X_Window xwin;
 #endif
 #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
-   uint64_t id;
+   uintptr_t id;
 #endif
    
    if (!pixmaps[type]) return NULL;
@@ -188,7 +188,7 @@ _e_pixmap_find(E_Pixmap_Type type, va_list *l)
         break;
       case E_PIXMAP_TYPE_WL:
 #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
-        id = va_arg(*l, uint64_t);
+        id = va_arg(*l, uintptr_t);
         return eina_hash_find(pixmaps[type], &id);
 #endif
         break;
@@ -225,7 +225,7 @@ e_pixmap_new(E_Pixmap_Type type, ...)
    Ecore_X_Window xwin;
 #endif
 #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
-   uint64_t id;
+   uintptr_t id;
 #endif
 
    EINA_SAFETY_ON_TRUE_RETURN_VAL((type != E_PIXMAP_TYPE_WL) && (type != E_PIXMAP_TYPE_X), NULL);
@@ -253,7 +253,7 @@ e_pixmap_new(E_Pixmap_Type type, ...)
         break;
       case E_PIXMAP_TYPE_WL:
 #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
-        id = va_arg(l, uint64_t);
+        id = va_arg(l, uintptr_t);
         if (pixmaps[type])
           {
              cp = eina_hash_find(pixmaps[type], &id);
@@ -264,7 +264,7 @@ e_pixmap_new(E_Pixmap_Type type, ...)
                }
           }
         else
-          pixmaps[type] = eina_hash_int64_new((Eina_Free_Cb)_e_pixmap_free);
+          pixmaps[type] = eina_hash_pointer_new((Eina_Free_Cb)_e_pixmap_free);
         cp = _e_pixmap_new(type);
         cp->win = id;
         eina_hash_add(pixmaps[type], &id, cp);
@@ -533,7 +533,7 @@ e_pixmap_res_id_get(E_Pixmap *cp)
    return cp->res_id;
 }
 
-EAPI uint64_t
+EAPI Ecore_Window
 e_pixmap_window_get(E_Pixmap *cp)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 0);
index 2d734c8..4110e2e 100644 (file)
@@ -38,7 +38,7 @@ EAPI E_Pixmap *e_pixmap_find(E_Pixmap_Type type, ...);
 EAPI E_Client *e_pixmap_find_client(E_Pixmap_Type type, ...);
 EAPI E_Client *e_pixmap_find_client_by_res_id(uint32_t res_id);
 EAPI uint32_t e_pixmap_res_id_get(E_Pixmap *cp);
-EAPI uint64_t e_pixmap_window_get(E_Pixmap *cp);
+EAPI Ecore_Window e_pixmap_window_get(E_Pixmap *cp);
 EAPI Ecore_Window e_pixmap_parent_window_get(E_Pixmap *cp);
 EAPI Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns);
 EAPI void e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache);
index f5a002d..24d4029 100644 (file)
@@ -67,16 +67,19 @@ _e_elm_win_trap_show(void *data, Evas_Object *o)
      {
         E_Client *ec;
         Ecore_Window win;
+#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
+        uintptr_t wl_win_id;
+#endif
         E_Pixmap_Type type = E_PIXMAP_TYPE_X;
 
         win = elm_win_window_id_get(o);
-#ifdef HAVE_WAYLAND_CLIENTS
+#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
         if (!strncmp(ecore_evas_engine_name_get(ee), "wayland", 7))
           {
              type = E_PIXMAP_TYPE_WL;
              ctx->pointer = e_comp->pointer;
              elm_win_borderless_set(o, 1);
-             win = e_comp_wl_id_get(win, getpid());
+             wl_win_id = win;
           }
 #endif
 #ifndef HAVE_WAYLAND_ONLY
@@ -88,7 +91,12 @@ _e_elm_win_trap_show(void *data, Evas_Object *o)
              ctx->pointer = e_pointer_window_new(win, EINA_TRUE);
           }
 #endif
-        ec = e_pixmap_find_client(type, win);
+#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
+        if (type == E_PIXMAP_TYPE_WL)
+          ec = e_pixmap_find_client(type, wl_win_id);
+        else
+#endif
+          ec = e_pixmap_find_client(type, win);
         if (ec)
           ctx->client = ec;
         else
@@ -104,7 +112,12 @@ _e_elm_win_trap_show(void *data, Evas_Object *o)
              if ((!title) || (!title[0]))
                title = "E";
              ecore_evas_title_set(ee, title);
-             cp = e_pixmap_new(type, win);
+#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
+             if (type == E_PIXMAP_TYPE_WL)
+               cp = e_pixmap_new(type, wl_win_id);
+             else
+#endif
+               cp = e_pixmap_new(type, win);
              EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_TRUE);
 
              ctx->client = e_client_new(e_comp, cp, 0, 1);
index da7b264..bfc699b 100644 (file)
@@ -14,7 +14,7 @@ _e_shell_surface_parent_set(E_Client *ec, struct wl_resource *parent_resource)
 {
    E_Pixmap *pp;
    E_Client *pc;
-   uint64_t pwin = 0;
+   Ecore_Window pwin = 0;
 
    if (!parent_resource)
      {
@@ -279,10 +279,12 @@ _e_shell_surface_cb_toplevel_set(struct wl_client *client EINA_UNUSED, struct wl
      }
 
    /* set toplevel client properties */
-   ec->borderless = !ec->internal;
+   if (!ec->internal)
+     ec->borderless = !ec->internal;
 
    ec->lock_border = EINA_TRUE;
-   ec->border.changed = ec->changes.border = !ec->borderless;
+   if (!ec->internal)
+     ec->border.changed = ec->changes.border = !ec->borderless;
    ec->netwm.type = E_WINDOW_TYPE_NORMAL;
    ec->comp_data->set_win_type = EINA_TRUE;
    if ((!ec->lock_user_maximize) && (ec->maximized))
@@ -344,9 +346,11 @@ _e_shell_surface_cb_popup_set(struct wl_client *client EINA_UNUSED, struct wl_re
         ec->comp_data->popup.y = y;
      }
 
-   ec->borderless = !ec->internal_elm_win;
+   if (!ec->internal)
+     ec->borderless = !ec->internal_elm_win;
    ec->lock_border = EINA_TRUE;
-   ec->border.changed = ec->changes.border = !ec->borderless;
+   if (!ec->internal)
+     ec->border.changed = ec->changes.border = !ec->borderless;
    ec->changes.icon = !!ec->icccm.class;
    ec->netwm.type = E_WINDOW_TYPE_POPUP_MENU;
    ec->comp_data->set_win_type = EINA_TRUE;
@@ -1219,9 +1223,11 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
 
    /* set toplevel client properties */
    ec->icccm.accepts_focus = 1;
-   ec->borderless = !ec->internal_elm_win;
+   if (!ec->internal)
+     ec->borderless = 1;
    ec->lock_border = EINA_TRUE;
-   ec->border.changed = ec->changes.border = !ec->borderless;
+   if ((!ec->internal) || (!ec->borderless))
+     ec->border.changed = ec->changes.border = !ec->borderless;
    ec->netwm.type = E_WINDOW_TYPE_NORMAL;
    ec->comp_data->set_win_type = EINA_TRUE;
 
@@ -1330,9 +1336,11 @@ _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource
    cdata->shell.unmap = _e_xdg_shell_surface_unmap;
 
    ec->override = 1;
-   ec->borderless = !ec->internal_elm_win;
+   if (!ec->internal)
+     ec->borderless = !ec->internal_elm_win;
    ec->lock_border = EINA_TRUE;
-   ec->border.changed = ec->changes.border = !ec->borderless;
+   if (!ec->internal)
+     ec->border.changed = ec->changes.border = !ec->borderless;
    ec->changes.icon = !!ec->icccm.class;
    ec->netwm.type = E_WINDOW_TYPE_POPUP_MENU;
    ec->comp_data->set_win_type = EINA_TRUE;