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 46b8f5ff65a89742a69f286e69f810fe8af8d413
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Tue Aug 22 10:01:54 2023 +0100
handle scaling for custom pos/size
---
src/efm/efm_back_end.c | 69 ++++++++++++++++++++++++++++++++------------------
src/efm/efm_dnd.c | 4 ++-
2 files changed, 47 insertions(+), 26 deletions(-)
diff --git a/src/efm/efm_back_end.c b/src/efm/efm_back_end.c
index 107bf79..fe49afa 100644
--- a/src/efm/efm_back_end.c
+++ b/src/efm/efm_back_end.c
@@ -271,6 +271,46 @@ _cb_thread_main(void *data, Ecore_Thread *th)
eina_stringshare_replace(&(prev_cmd), NULL);
}
+static void
+_icon_xy_wh_get(Smart_Data *sd, Icon *icon, Cmd *c)
+{
+ const char *s;
+ int x, y, w, h, raw_x = -9999, raw_y = -9999;
+
+ s = cmd_key_find(c, "meta.xy");
+ if (s)
+ {
+ if (sscanf(s, "%i,%i", &x, &y) == 2)
+ {
+ raw_x = x;
+ raw_y = y;
+ x *= _scale_get(sd);
+ y *= _scale_get(sd);
+ icon->geom.x = x;
+ icon->geom.y = y;
+ }
+ }
+ s = cmd_key_find(c, "meta.wh");
+ if (s)
+ {
+ if (sscanf(s, "%ix%i", &w, &h) == 2)
+ {
+ if (raw_x == -9999)
+ {
+ w = ((raw_x + w) * _scale_get(sd)) - icon->geom.x;
+ h = ((raw_y + h) * _scale_get(sd)) - icon->geom.y;
+ }
+ else
+ {
+ w *= _scale_get(sd);
+ h *= _scale_get(sd);
+ }
+ icon->geom.w = w;
+ icon->geom.h = h;
+ }
+ }
+}
+
static void
_cb_thread_notify(void *data, Ecore_Thread *th EINA_UNUSED, void *msg)
{ // handle data from the view thread to the UI - this will be a batch of cmds
@@ -437,32 +477,8 @@ _cb_thread_notify(void *data, Ecore_Thread *th EINA_UNUSED, void *msg)
eina_stringshare_replace((&icon->info.mime),
"inode/file");
- s = cmd_key_find(c, "meta.xy");
- if (s)
- {
- int x, y;
-
- if (sscanf(s, "%i,%i", &x, &y) == 2)
- {
- x *= _scale_get(sd);
- y *= _scale_get(sd);
- icon->geom.x = x;
- icon->geom.y = y;
- }
- }
- s = cmd_key_find(c, "meta.wh");
- if (s)
- {
- int w, h;
+ _icon_xy_wh_get(sd, icon, c);
- if (sscanf(s, "%ix%i", &w, &h) == 2)
- {
- w *= _scale_get(sd);
- h *= _scale_get(sd);
- icon->geom.w = w;
- icon->geom.h = h;
- }
- }
for ( ; il; il = il->next)
{
icon2 = il->data;
@@ -597,6 +613,9 @@ _cb_thread_notify(void *data, Ecore_Thread *th EINA_UNUSED, void *msg)
_size_bars_update_queue(sd);
}
}
+
+ _icon_xy_wh_get(sd, icon, c);
+
cmd_free(icon->cmd);
icon->cmd = c;
break;
diff --git a/src/efm/efm_dnd.c b/src/efm/efm_dnd.c
index 35ffef1..7e2d486 100644
--- a/src/efm/efm_dnd.c
+++ b/src/efm/efm_dnd.c
@@ -195,7 +195,9 @@ _cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
// XXX: use strbuf for str
snprintf(str, sizeof(str), "%s/%s", icon->sd->path, icon->info.file);
cmd_strbuf_append(buf, "path", str);
- snprintf(str, sizeof(str), "%i,%i", icon->geom.x, icon->geom.y);
+ snprintf(str, sizeof(str), "%i,%i",
+ (int)(icon->geom.x / _scale_get(icon->sd)),
+ (int)(icon->geom.y / _scale_get(icon->sd)));
cmd_strbuf_append(buf, "xy", str);
cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.