e_pixmap_free(ep);
return;
}
+ else
+ e_pixmap_del(ep);
evas_object_hide(ec->frame);
e_object_del(E_OBJECT(ec));
_e_comp_wl_surface_destroy);
wl_client_get_credentials(client, &pid, NULL, NULL);
- if (pid == getpid()) //internal!
- ep = e_pixmap_find(E_PIXMAP_TYPE_WL, (uintptr_t)id);
+ if (pid == getpid())
+ {
+ /* pixmap of internal win was supposed to be created at trap show */
+ ep = e_pixmap_find(E_PIXMAP_TYPE_WL, (uintptr_t)id);
+ }
+ else
+ {
+ if ((ep = e_pixmap_find(E_PIXMAP_TYPE_WL, (uintptr_t)res)))
+ {
+ ERR("There is e_pixmap already, Delete old e_pixmap %p", ep);
+ e_pixmap_del(ep);
+ ep = NULL;
+ }
+ }
+
if (!ep)
{
/* try to create new pixmap */
if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, (uintptr_t)surface_resource)))
{
Eina_List *l;
+ E_Pixmap *ep = NULL;
- ec = e_client_new(NULL, e_pixmap_new(E_PIXMAP_TYPE_WL, surface_resource), 1, 0);
+ ep = e_pixmap_find(E_PIXMAP_TYPE_WL, surface_resource);
+ if (!ep) ep = e_pixmap_new(E_PIXMAP_TYPE_WL, surface_resource);
+ EINA_SAFETY_ON_NULL_RETURN(ep);
+
+ ec = e_client_new(NULL, ep, 1, 0);
if (!ec) return;
ec->lock_focus_out = ec->layer_block = ec->visible = ec->override = 1;
ec->new_client = 0;
#endif
static Eina_Hash *pixmaps[2] = {NULL};
+static Eina_Hash *deleted[2] = {NULL};
static Eina_Hash *res_ids = NULL;
static uint32_t res_id = 0;
_e_pixmap_hook_call(E_PIXMAP_HOOK_DEL, cp);
e_pixmap_image_clear(cp, EINA_FALSE);
if (cp->parent) eina_hash_set(pixmaps[cp->type], &cp->parent, NULL);
+ eina_hash_del_by_key(res_ids, &cp->res_id);
eina_hash_del_by_key(pixmaps[cp->type], &cp->win);
+
+ if (e_pixmap_is_del(cp))
+ eina_hash_del_by_key(deleted[cp->type], &cp->win);
+ else
+ _e_pixmap_free(cp);
+
return 0;
}
+EAPI void
+e_pixmap_del(E_Pixmap *cp)
+{
+#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
+ if (!cp) return;
+ if (cp->type != E_PIXMAP_TYPE_WL) return;
+ if (eina_hash_find(pixmaps[cp->type], &cp->win))
+ {
+ eina_hash_del_by_key(pixmaps[cp->type], &cp->win);
+ eina_hash_add(deleted[cp->type], &cp->win, cp);
+ }
+#endif
+}
+
+EAPI Eina_Bool
+e_pixmap_is_del(E_Pixmap *cp)
+{
+#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
+ if (!cp) return 0;
+ if (cp->type != E_PIXMAP_TYPE_WL) return 0;
+ return !!eina_hash_find(deleted[cp->type], &cp->win);
+#endif
+}
+
EAPI E_Pixmap *
e_pixmap_ref(E_Pixmap *cp)
{
}
}
else
- pixmaps[type] = eina_hash_pointer_new((Eina_Free_Cb)_e_pixmap_free);
+ {
+ pixmaps[type] = eina_hash_pointer_new(NULL);
+ deleted[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);
if (!res_ids)
- res_ids = eina_hash_int32_new((Eina_Free_Cb)_e_pixmap_free);
+ res_ids = eina_hash_int32_new(NULL);
cp->res_id = res_id;
eina_hash_add(res_ids, &res_id, cp);
res_id++;
};
EAPI int e_pixmap_free(E_Pixmap *cp);
+EAPI void e_pixmap_del(E_Pixmap *cp);
+EAPI Eina_Bool e_pixmap_is_del(E_Pixmap *cp);
EAPI E_Pixmap *e_pixmap_ref(E_Pixmap *cp);
EAPI E_Pixmap *e_pixmap_new(E_Pixmap_Type type, ...);
EAPI E_Pixmap_Type e_pixmap_type_get(const E_Pixmap *cp);
ecore_evas_title_set(ee, title);
#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY)
if (type == E_PIXMAP_TYPE_WL)
- cp = e_pixmap_new(type, wl_win_id);
+ {
+ if ((cp = e_pixmap_find(type, wl_win_id)))
+ {
+ ERR("There is e_pixmap already, Delete old e_pixmap %p", cp);
+ e_pixmap_del(cp);
+ cp = NULL;
+ }
+ /* first creation of pixmap for internal window */
+ if (!cp)
+ cp = e_pixmap_new(type, wl_win_id);
+ }
else
#endif
cp = e_pixmap_new(type, win);