diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-04-01 14:16:21 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-04-01 14:16:21 -0400 |
commit | 3cb11abb254ddeb9ca5f4dfe812325a784570293 (patch) | |
tree | 36791905966bfa54a139ed821ee29612bb8c323e /src/bin/e_client.c | |
parent | 8f0f9ce4f7aa5e7325153560ff5c8ea440b885d3 (diff) | |
download | enlightenment-3cb11abb254ddeb9ca5f4dfe812325a784570293.tar.gz |
move x11 client icon caching to private functions in comp_x
ref 57ce6419e5c257e6fee6809cdb9c63d39c0b0a98
Diffstat (limited to 'src/bin/e_client.c')
-rw-r--r-- | src/bin/e_client.c | 103 |
1 files changed, 1 insertions, 102 deletions
diff --git a/src/bin/e_client.c b/src/bin/e_client.c index e2a2bf652d..3d529848bf 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -532,12 +532,7 @@ _e_client_free(E_Client *ec) ec->group = eina_list_free(ec->group); ec->transients = eina_list_free(ec->transients); ec->stick_desks = eina_list_free(ec->stick_desks); - if (ec->netwm.icons) - { - e_client_icon_free(ec->netwm.icons, ec->netwm.num_icons); - ec->netwm.icons = NULL; - ec->netwm.num_icons = 0; - } + E_FREE(ec->netwm.extra_types); eina_stringshare_replace(&ec->border.name, NULL); eina_stringshare_replace(&ec->bordername, NULL); @@ -5022,99 +5017,3 @@ e_client_layout_cb_set(E_Client_Layout_Cb cb) CRI("ATTEMPTING TO OVERWRITE EXISTING CLIENT LAYOUT HOOK!!!"); _e_client_layout_cb = cb; } - -//////////////////////////////////////////// -static Eina_List *iconshare = NULL; - -typedef struct _E_Client_Icon_Entry E_Client_Icon_Entry; - -struct _E_Client_Icon_Entry -{ - Ecore_X_Icon *icons; - int num_icons; - int ref; -}; - -E_API Ecore_X_Icon * -e_client_icon_deduplicate(Ecore_X_Icon *icons, int num_icons) -{ - int i; - Eina_List *l; - E_Client_Icon_Entry *ie; - - // unless the rest of e uses border icons OTHER than icon #0 - // then free the rest that we don't need anymore. - for (i = 1; i < num_icons; i++) - { - free(icons[i].data); - icons[i].data = NULL; - } - // lookup icon data in icons cache/share - EINA_LIST_FOREACH(iconshare, l, ie) - { - if ((ie->num_icons == num_icons) && - (num_icons > 0) && - (ie->icons[0].width == icons[0].width) && - (ie->icons[0].height == icons[0].height) && - (!memcmp(ie->icons[0].data, icons[0].data, - icons[0].width * icons[0].height * 4))) - { - // found so free the input icons - for (i = 0; i < num_icons; i++) - free(icons[i].data); - free(icons); - // ref the shared/cached one - ie->ref++; - iconshare = eina_list_promote_list(iconshare, l); - // and return that - return ie->icons; - } - } - // no hit - new entry to cache. add it - ie = calloc(1, sizeof(E_Client_Icon_Entry)); - if (ie) - { - ie->icons = icons; - ie->num_icons = num_icons; - ie->ref = 1; - iconshare = eina_list_prepend(iconshare, ie); - } - return icons; -} - -E_API void -e_client_icon_free(Ecore_X_Icon *icons, int num_icons) -{ - int i; - Eina_List *l; - E_Client_Icon_Entry *ie; - - // lookup in icon share cache - EINA_LIST_FOREACH(iconshare, l, ie) - { - if ((ie->num_icons == num_icons) && - (num_icons > 0) && - (ie->icons[0].width == icons[0].width) && - (ie->icons[0].height == icons[0].height) && - (!memcmp(ie->icons[0].data, icons[0].data, - icons[0].width * icons[0].height * 4))) - { - // found so deref - ie->ref--; - if (ie->ref <= 0) - { - // no refs left - free the icon from the share/cache - iconshare = eina_list_remove_list(iconshare, l); - for (i = 0; i < ie->num_icons; i++) - free(ie->icons[i].data); - free(ie->icons); - free(ie); - } - return; - } - } - // not found - so just free it ... odd - we should never be here - for (i = 0; i < num_icons; i++) - free(icons[i].data); - free(icons); -} |