forked from enlightenment/enlightenment
move e_util_icon_save to e_desktop_editor for better waylanding
This commit is contained in:
parent
c2be19c093
commit
1b22c40555
|
@ -61,6 +61,38 @@ static void _e_desktop_editor_icon_entry_changed(void *data, Evas_Object
|
|||
#define IFDUP(src, dst) if (src) dst = strdup(src); else \
|
||||
dst = NULL
|
||||
|
||||
|
||||
static int
|
||||
_e_util_icon_save(Ecore_X_Icon *icon, const char *filename)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas *evas;
|
||||
Evas_Object *im;
|
||||
int ret;
|
||||
|
||||
ee = ecore_evas_buffer_new(icon->width, icon->height);
|
||||
if (!ee) return 0;
|
||||
evas = ecore_evas_get(ee);
|
||||
evas_image_cache_set(evas, 0);
|
||||
evas_font_cache_set(evas, 0);
|
||||
|
||||
im = evas_object_image_add(evas);
|
||||
if (!im)
|
||||
{
|
||||
ecore_evas_free(ee);
|
||||
return 0;
|
||||
}
|
||||
evas_object_move(im, 0, 0);
|
||||
evas_object_resize(im, icon->width, icon->height);
|
||||
evas_object_image_size_set(im, icon->width, icon->height);
|
||||
evas_object_image_data_copy_set(im, icon->data);
|
||||
evas_object_image_alpha_set(im, 1);
|
||||
evas_object_show(im);
|
||||
ret = evas_object_image_save(im, filename, NULL, NULL);
|
||||
evas_object_del(im);
|
||||
ecore_evas_free(ee);
|
||||
return ret;
|
||||
}
|
||||
/* externally accessible functions */
|
||||
|
||||
EAPI Efreet_Desktop *
|
||||
|
@ -143,7 +175,7 @@ e_desktop_client_create(E_Client *ec)
|
|||
|
||||
snprintf(file, sizeof(file), "%s-%.6f.png", bname ?: "", ecore_time_get());
|
||||
snprintf(path, sizeof(path), "%s/%s", icon_dir, file);
|
||||
if (e_util_icon_save(&(ec->netwm.icons[0]), path))
|
||||
if (_e_util_icon_save(&(ec->netwm.icons[0]), path))
|
||||
desktop->icon = strdup(file);
|
||||
else
|
||||
fprintf(stderr, "Could not save file from ARGB: %s\n", path);
|
||||
|
|
|
@ -614,37 +614,6 @@ e_util_filename_escape(const char *filename)
|
|||
return buf;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
e_util_icon_save(Ecore_X_Icon *icon, const char *filename)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas *evas;
|
||||
Evas_Object *im;
|
||||
int ret;
|
||||
|
||||
ee = ecore_evas_buffer_new(icon->width, icon->height);
|
||||
if (!ee) return 0;
|
||||
evas = ecore_evas_get(ee);
|
||||
evas_image_cache_set(evas, 0);
|
||||
evas_font_cache_set(evas, 0);
|
||||
|
||||
im = evas_object_image_add(evas);
|
||||
if (!im)
|
||||
{
|
||||
ecore_evas_free(ee);
|
||||
return 0;
|
||||
}
|
||||
evas_object_move(im, 0, 0);
|
||||
evas_object_resize(im, icon->width, icon->height);
|
||||
evas_object_image_size_set(im, icon->width, icon->height);
|
||||
evas_object_image_data_copy_set(im, icon->data);
|
||||
evas_object_image_alpha_set(im, 1);
|
||||
evas_object_show(im);
|
||||
ret = evas_object_image_save(im, filename, NULL, NULL);
|
||||
evas_object_del(im);
|
||||
ecore_evas_free(ee);
|
||||
return ret;
|
||||
}
|
||||
|
||||
EAPI char *
|
||||
e_util_shell_env_path_eval(const char *path)
|
||||
|
|
|
@ -39,7 +39,6 @@ EAPI E_Client *e_util_desk_client_below(E_Client *ec);
|
|||
EAPI int e_util_edje_collection_exists(const char *file, const char *coll);
|
||||
EAPI E_Dialog *e_util_dialog_internal(const char *title, const char *txt);
|
||||
EAPI const char *e_util_filename_escape(const char *filename);
|
||||
EAPI int e_util_icon_save(Ecore_X_Icon *icon, const char *filename);
|
||||
EAPI char *e_util_shell_env_path_eval(const char *path);
|
||||
EAPI char *e_util_size_string_get(off_t size);
|
||||
EAPI char *e_util_file_time_get(time_t ftime);
|
||||
|
|
Loading…
Reference in New Issue