This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit 25971015bda4c15f5199837cec7a21822bc7be24
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Thu Sep 28 18:35:46 2023 +0100
add commands going back to backend from dnd/cnp/keypresses/clicks etc
---
src/efm/efm.c | 28 ++++++++++++++
src/efm/efm_dnd.c | 69 ++++++++++++++++++++++++++--------
src/efm/efm_util.c | 98 ++++++++++++++++++++++++++++++++++++-------------
src/shared/common/cmd.h | 28 ++++++++++----
4 files changed, 174 insertions(+), 49 deletions(-)
diff --git a/src/efm/efm.c b/src/efm/efm.c
index fef49bc..81c29bc 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -188,8 +188,22 @@ _cb_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
if (sd->last_focused)
{
Icon *icon = sd->last_focused;
+ Eina_Strbuf *strbuf = eina_strbuf_new();
if (!icon->selected) _icon_select(icon);
+
+ if (strbuf)
+ {
+ if (_selected_icons_uri_strbuf_append(sd, strbuf))
+ {
+ Eina_Strbuf *buf = cmd_strbuf_new("file-run");
+
+ _uri_list_cmd_strbuf_append(buf, "path",
+ eina_strbuf_string_get(strbuf));
+ cmd_strbuf_exe_consume(buf, sd->exe_open);
+ }
+ eina_strbuf_free(strbuf);
+ }
// XXX: handle "open" of all selected files/icons (double-click)
handled = EINA_TRUE;
}
@@ -230,6 +244,20 @@ _cb_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
// }
else if (!strcmp(ev->key, "Delete"))
{
+ Eina_Strbuf *strbuf = eina_strbuf_new();
+
+ if (strbuf)
+ {
+ if (_selected_icons_uri_strbuf_append(sd, strbuf))
+ {
+ Eina_Strbuf *buf = cmd_strbuf_new("file-delete");
+
+ _uri_list_cmd_strbuf_append(buf, "path",
+ eina_strbuf_string_get(strbuf));
+ cmd_strbuf_exe_consume(buf, sd->exe_open);
+ }
+ eina_strbuf_free(strbuf);
+ }
// XXX: delete file
handled = EINA_TRUE;
}
diff --git a/src/efm/efm_dnd.c b/src/efm/efm_dnd.c
index 705b087..6b7a788 100644
--- a/src/efm/efm_dnd.c
+++ b/src/efm/efm_dnd.c
@@ -126,14 +126,43 @@ _cb_drop_pos(void *data, Evas_Object *o EINA_UNUSED, Evas_Coord x, Evas_Coord y,
static Eina_Bool
_cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
{
- Smart_Data *sd = data;
- char **plist, **p, *esc, *tmp;
- Eina_List *dropicons, *l;
- Icon *icon;
- int delta_x = 0, delta_y = 0;
+ Smart_Data *sd = data;
+ char **plist, **p, *esc, *tmp;
+ Eina_List *dropicons, *l;
+ Icon *icon;
+ int delta_x = 0, delta_y = 0;
+ Eina_Strbuf *buf = cmd_strbuf_new("dnd-drop");
+
+ switch (ev->action)
+ {
+ case ELM_XDND_ACTION_COPY:
+ cmd_strbuf_append(buf, "action", "copy");
+ break;
+ case ELM_XDND_ACTION_MOVE:
+ cmd_strbuf_append(buf, "action", "move");
+ break;
+ case ELM_XDND_ACTION_ASK:
+ cmd_strbuf_append(buf, "action", "ask");
+ break;
+ case ELM_XDND_ACTION_LIST:
+ cmd_strbuf_append(buf, "action", "list");
+ break;
+ case ELM_XDND_ACTION_LINK:
+ cmd_strbuf_append(buf, "action", "link");
+ break;
+ case ELM_XDND_ACTION_DESCRIPTION:
+ cmd_strbuf_append(buf, "action", "description");
+ break;
+ default:
+ break;
+ }
if (sd->drop_over)
- printf("XXX: DND DROP OVER [%s]\n", sd->drop_over->info.file);
+ {
+ printf("XXX: DND DROP OVER [%s]\n", sd->drop_over->info.file);
+ _icon_path_cmd_strbuf_append(buf, "over", sd, sd->drop_over);
+ }
+
else printf("XXX: DND DROP ...\n");
tmp = malloc(ev->len + 1);
if (!tmp) goto err;
@@ -167,6 +196,8 @@ _cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
EINA_LIST_FREE(dropicons, icon);
}
}
+ _uri_list_cmd_strbuf_append(buf, "path", tmp);
+ cmd_strbuf_exe_consume(buf, sd->exe_open);
for (p = plist; *p != NULL; ++p)
{
if (**p)
@@ -181,8 +212,7 @@ _cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
{
if (icon->selected)
{
- Eina_Strbuf *buf;
- char str[PATH_MAX];
+ char str[128];
if ((icon->sd == sd) /*(icon->drag)*/)
{
@@ -197,11 +227,7 @@ _cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
printf("XXX: -> DROPICON: [%s] %i %i\n",
icon->info.file, icon->geom.x, icon->geom.y);
buf = cmd_strbuf_new("meta-set");
- // sd->config.path always ends in /
- // XXX: use strbuf for str
- snprintf(str, sizeof(str), "%s%s", icon->sd->config.path,
- icon->info.file);
- cmd_strbuf_append(buf, "path", str);
+ _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
snprintf(str, sizeof(str), "%i,%i",
(int)(icon->geom.x / _scale_get(icon->sd)),
(int)(icon->geom.y / _scale_get(icon->sd)));
@@ -301,13 +327,16 @@ _cb_drag_done(void *data, Evas_Object *obj_drag EINA_UNUSED)
{
Icon *icon = data;
Evas_Object *obj;
+ Eina_Strbuf *buf;
if (icon->sd)
{
obj = icon->sd->o_smart;
- ENTRY;
+ ENTRY _icon_free(icon);
printf("DND: drag done %p %p\n", obj, obj_drag);
+ buf = cmd_strbuf_new("dnd-drag-end");
+ if (buf) cmd_strbuf_exe_consume(buf, sd->exe_open);
sd->drag = EINA_FALSE;
icon->o_base = NULL; // try and not del this as dnd will do it
icon->sd->drag_icon = NULL;
@@ -333,7 +362,17 @@ _drag_start(Icon *icon)
icon->sd->just_dragged = EINA_TRUE;
icon->sd->drag_icon = icon_dup;
if (_selected_icons_uri_strbuf_append(icon->sd, strbuf))
- { // begin the drag with that list of files
+ {
+ Eina_Strbuf *buf = cmd_strbuf_new("dnd-drag-begin");
+
+ if (buf)
+ {
+ cmd_strbuf_append(buf, "action", "move");
+ _uri_list_cmd_strbuf_append(buf, "path",
+ eina_strbuf_string_get(strbuf));
+ cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
+ }
+ // begin the drag with that list of files
// XXX: if you use no modifier - do default (move)
// XXX: if you hold ctrl then do copy
// XXX: on win ... to/from removable drive it copies always
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index 8eb9f6d..883cbe0 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -88,6 +88,8 @@ _icons_path_find(const char *path)
Eina_List *icons = NULL;
strbuf = eina_strbuf_new();
+ if (!strbuf) return NULL;
+
EINA_LIST_FOREACH(_efm_list, l, obj)
{
ENTRY icons;
@@ -686,6 +688,44 @@ _icon_file_set(Icon *icon, const char *file)
}
}
+static void
+_icon_path_cmd_strbuf_append(Eina_Strbuf *strbuf, const char *key,
+ Smart_Data *sd, Icon *icon)
+{
+ Eina_Strbuf *buf = eina_strbuf_new();
+
+ if (!buf) return;
+ eina_strbuf_append(buf, sd->config.path);
+ eina_strbuf_append(buf, icon->info.file);
+ cmd_strbuf_append(strbuf, key, eina_strbuf_string_get(buf));
+ eina_strbuf_free(buf);
+}
+
+static void
+_uri_list_cmd_strbuf_append(Eina_Strbuf *strbuf, const char *key,
+ const char *urilist)
+{
+ char *tmps = strdup(urilist), *se, *s2, *s;
+ size_t len;
+
+ if (!tmps) return;
+ for (s = tmps; *s; s = s2)
+ {
+ se = strchr(s, '\n');
+ if (!se)
+ {
+ len = strlen(s);
+ se = s + len;
+ s2 = NULL;
+ }
+ else s2 = se + 1;
+ *se = '\0';
+ cmd_strbuf_append(strbuf, key, s);
+ if (!s2) break;
+ }
+ free(tmps);
+}
+
static void
_cb_icon_mouse_down(void *data, Evas *e EINA_UNUSED,
Evas_Object *obj EINA_UNUSED, void *event_info)
@@ -728,8 +768,18 @@ _cb_icon_mouse_down(void *data, Evas *e EINA_UNUSED,
}
else if (ev->flags == EVAS_BUTTON_DOUBLE_CLICK)
{ // double clicked
- // XXX:
+ Eina_Strbuf *buf = cmd_strbuf_new("file-run");
+ Eina_Strbuf *strbuf = eina_strbuf_new();
+
printf("XXX: DBL\n");
+ if (strbuf)
+ {
+ _icon_path_cmd_strbuf_append(buf, "over", icon->sd, icon);
+ _selected_icons_uri_strbuf_append(icon->sd, strbuf);
+ _uri_list_cmd_strbuf_append(buf, "path", eina_strbuf_string_get(strbuf));
+ cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
+ eina_strbuf_free(strbuf);
+ }
}
}
}
@@ -772,6 +822,7 @@ _icon_select_update(Icon *icon)
_icon_text_update(icon);
}
+
static Eina_Bool
_cb_dnd_over_open_timer(void *data)
@@ -781,7 +832,11 @@ _cb_dnd_over_open_timer(void *data)
sd->dnd_over_open_timer = NULL;
if (sd->drop_over)
{
+ Eina_Strbuf *buf = cmd_strbuf_new("dnd-hover");
+
printf("XXX: open hover dir [%s]\n", sd->drop_over->info.file);
+ _icon_path_cmd_strbuf_append(buf, "path", sd, sd->drop_over);
+ cmd_strbuf_exe_consume(buf, sd->exe_open);
// XXX: open dir smart callback
}
return EINA_FALSE;
@@ -836,6 +891,12 @@ _icon_select(Icon *icon)
icon->block->selected_num++;
icon->sd->last_selected = icon;
_icon_select_update(icon);
+ if (icon->sd)
+ {
+ Eina_Strbuf *buf = cmd_strbuf_new("file-selected");
+ _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
+ cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
+ }
}
static void
@@ -846,6 +907,12 @@ _icon_unselect(Icon *icon)
icon->selected = EINA_FALSE;
icon->block->selected_num--;
_icon_select_update(icon);
+ if (icon->sd)
+ {
+ Eina_Strbuf *buf = cmd_strbuf_new("file-unselected");
+ _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
+ cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
+ }
}
static Eina_Bool
@@ -914,7 +981,11 @@ _cb_icon_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
}
if (!dragged)
{
+ Eina_Strbuf *buf = cmd_strbuf_new("file-clicked");
+
printf("XXX: mouse clicked\n");
+ _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
+ cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
{ // range select
if (icon->sd->last_selected)
@@ -1543,28 +1614,3 @@ _cb_reblock(void *data)
sd->reblocked = EINA_TRUE;
evas_object_smart_changed(sd->o_smart);
}
-
-static void
-_uri_list_cmd_strbuf_append(Eina_Strbuf *strbuf, const char *key,
- const char *urilist)
-{
- char *tmps = strdup(urilist), *se, *s2, *s;
- size_t len;
-
- if (!tmps) return;
- for (s = tmps; *s; s = s2)
- {
- se = strchr(s, '\n');
- if (!se)
- {
- len = strlen(s);
- se = s + len;
- s2 = NULL;
- }
- else s2 = se + 1;
- *se = '\0';
- cmd_strbuf_append(strbuf, key, s);
- if (!s2) break;
- }
- free(tmps);
-}
diff --git a/src/shared/common/cmd.h b/src/shared/common/cmd.h
index 4cbb042..0eabcda 100644
--- a/src/shared/common/cmd.h
+++ b/src/shared/common/cmd.h
@@ -8,18 +8,30 @@
// CURRENT COMMANDS:
////////////////////
//
-// file-add // a dile in a dir being monitored has been added
-// file-del // a file in a dir being monitored has been deleted
-// file-mod // a file in a dir being monitored has been modified
-// dir-set // tell the backend what dir to open/list/watch
-// dir-del // the dir being monitored/listed has been deleted
-// meta-set // set metadata for a file path
-// list-begin // begin initial listing of dir
-// list-end // end initial listing of dir
+// file-add // a dile in a dir being monitored has been added
+// file-del // a file in a dir being monitored has been deleted
+// file-mod // a file in a dir being monitored has been modified
+// dir-set // tell the backend what dir to open/list/watch
+// dir-del // the dir being monitored/listed has been deleted
+// meta-set // set metadata for a file path
+// list-begin // begin initial listing of dir
+// list-end // end initial listing of dir
+// viewmode-set
+// detail-header-set
//
// cnp-cut
// cnp-copy
// cnp-paste
+// dnd-drag-begin
+// dnd-drag-end
+// dnd-drop
+// dnd-hover
+//
+// file-run
+// file-clicked
+// file-selected
+// file-unselected
+// file-delete
//
////////////////////
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.