This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository enlightenment.
View the commit online.
commit f5f93752b5ab628b6823c2d12b0ea4054f9f5576
Author: Carsten Haitzler <[email protected]>
AuthorDate: Wed Jan 28 18:29:31 2026 +0000
clipboard - store type too
so handling string types right now - text, markup, html, urilist. mage
needs specal handlng. for images need to move to storing data in
external files - one file per item and have the list items map to
these files. this is a future feature to do. not now.
---
src/modules/clipboard/e_mod_config.c | 41 ++++++++++++++++++++++++++++--------
src/modules/clipboard/e_mod_main.c | 3 +--
src/modules/clipboard/e_mod_main.h | 4 +++-
3 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/src/modules/clipboard/e_mod_config.c b/src/modules/clipboard/e_mod_config.c
index 0a779becb..2007f9c82 100644
--- a/src/modules/clipboard/e_mod_config.c
+++ b/src/modules/clipboard/e_mod_config.c
@@ -173,6 +173,7 @@ config_init(void)
#define T Config_Item
#define D conf_item_edd
E_CONFIG_VAL(D, T, str, STRI);
+ E_CONFIG_VAL(D, T, type, INT);
conf_edd = E_CONFIG_DD_NEW("Config", Config);
if (!conf_edd) return EINA_FALSE;
#undef T
@@ -270,26 +271,48 @@ void
config_paste_add(const char *data, size_t size, int type)
{
Config_Item *cd = NULL;
- const char *last = "";
+ Config_Item *cd_last = NULL;
+ char *str = NULL;
Eina_List *l;
- if (!data) return;
- if (cfg->items) last = ((Config_Item *)eina_list_data_get(cfg->items))->str;
- if (!strcmp(last, data)) return; // same as last one we added
- if (_empty(data)) return; // empty - we don't want it
+ if (!data) goto done;
+ // if we don't handle the type - don't add.
+ if (!((type == ELM_SEL_FORMAT_TEXT) ||
+ (type == ELM_SEL_FORMAT_MARKUP) ||
+// not handled yet
+// (type == ELM_SEL_FORMAT_IMAGE) ||
+ (type == ELM_SEL_FORMAT_HTML) ||
+ (type == ELM_SEL_FORMAT_URILIST))) goto done;
+ if (cfg->items) cd_last = eina_list_data_get(cfg->items);
+ // let's make a string we know is 0 terminated from data
+ str = malloc(size + 1);
+ if (!str) goto done;
+ memcpy(str, data, size);
+ str[size] = 0;
+ if (_empty(str)) goto done; // empty - we don't want it
+ if ((cd_last) && (cd_last->type == type))
+ { // same as last?
+ if (type != ELM_SEL_FORMAT_IMAGE) // all other types are string
+ { // same data - skip storing
+ if (!strcmp(cd_last->str, str)) goto done;
+ }
+ }
EINA_LIST_FOREACH(cfg->items, l, cd)
{
- if (!strcmp(data, cd->str))
+ if (!strcmp(str, cd->str))
{// promote to last - already there
cfg->items = eina_list_promote_list(cfg->items, l);
- return;
+ goto done;
}
}
// not there already
cd = E_NEW(Config_Item, 1);
- if (!cd) return;
+ if (!cd) goto done;
// XXX: if we select huge amounts of text this could use a lot of ram
- cd->str = eina_stringshare_add(data);
+ cd->str = eina_stringshare_add(str);
+ cd->type = type;
cfg->items = eina_list_prepend(cfg->items, cd);
config_hist_limit();
+done:
+ free(str);
}
diff --git a/src/modules/clipboard/e_mod_main.c b/src/modules/clipboard/e_mod_main.c
index 73b98bca3..34a69a750 100644
--- a/src/modules/clipboard/e_mod_main.c
+++ b/src/modules/clipboard/e_mod_main.c
@@ -285,8 +285,7 @@ _cb_sel(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
if (idx < 0) return;
cd = eina_list_nth(cfg->items, idx - 1);
if (cd) elm_cnp_selection_set(mod.ewin, ELM_SEL_TYPE_CLIPBOARD,
- ELM_SEL_FORMAT_TEXT, cd->str,
- strlen(cd->str));
+ cd->type, cd->str, strlen(cd->str));
_clipboard_popup_free(inst);
}
diff --git a/src/modules/clipboard/e_mod_main.h b/src/modules/clipboard/e_mod_main.h
index 2ee6d73aa..6b9c51759 100644
--- a/src/modules/clipboard/e_mod_main.h
+++ b/src/modules/clipboard/e_mod_main.h
@@ -84,7 +84,9 @@ struct _Config
struct _Config_Item
{
- const char *str; // stored string (stringshare)
+ const char *str; // string label if needed
+ int type; // type of matching file (Elm_Sel_Format)
+ // 1 = text, 2 = markup, 4 = image, 16 = html, 32 = urilist
};
E_Config_Dialog *config_clipboard_module(Evas_Object *parent, const char *params EINA_UNUSED);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.