aboutsummaryrefslogtreecommitdiff
path: root/shared/toxy
diff options
context:
space:
mode:
Diffstat (limited to 'shared/toxy')
-rw-r--r--shared/toxy/scriptlet.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/shared/toxy/scriptlet.c b/shared/toxy/scriptlet.c
index f7ce800..a2f5ee0 100644
--- a/shared/toxy/scriptlet.c
+++ b/shared/toxy/scriptlet.c
@@ -200,30 +200,56 @@ static char *scriptlet_dedot(t_scriptlet *sp, char *ibuf, char *obuf,
t_canvas *cv;
if (cv = scriptlet_canvasvalidate(sp, 0))
{
+ t_glist *glist;
if (!strncmp(&ibuf[1], "tag", 3))
{
t_rtext *rt;
- if (cv->gl_owner && glist_isvisible(cv->gl_owner) &&
- cv->gl_owner->gl_editor &&
- (rt = glist_findrtext(cv->gl_owner, (t_object *)cv)))
+ glist = cv->gl_owner;
+ if (glist && glist_isvisible(glist) && glist->gl_editor
+ && (rt = glist_findrtext(glist, (t_object *)cv)))
sprintf(obuf, "%s", rtext_gettag(rt));
else
obuf[0] = 0;
len = 4;
}
- else if (!strncmp(&ibuf[1], "owner", 5))
+ else if (!strncmp(&ibuf[1], "parent", 6))
{
- if (cv->gl_owner && glist_isvisible(cv->gl_owner))
- sprintf(obuf, ".x%x", (int)cv->gl_owner);
+ glist = cv->gl_owner;
+ if (glist && glist_isvisible(glist))
+ sprintf(obuf, ".x%x", (int)glist);
else
obuf[0] = 0;
- len = 6;
+ len = 7;
}
else if (!strncmp(&ibuf[1], "root", 4))
{
- sprintf(obuf, ".x%x", (int)canvas_getrootfor(cv));
+ glist = canvas_getrootfor(cv);
+ if (glist && glist_isvisible(glist))
+ sprintf(obuf, ".x%x", (int)glist);
+ else
+ obuf[0] = 0;
len = 5;
}
+ else if (!strncmp(&ibuf[1], "owner", 5))
+ {
+ if (glist = canvas_getrootfor(cv))
+ glist = glist->gl_owner;
+ if (glist && glist_isvisible(glist))
+ sprintf(obuf, ".x%x", (int)glist);
+ else
+ obuf[0] = 0;
+ len = 6;
+ }
+ else if (!strncmp(&ibuf[1], "top", 3))
+ {
+ glist = cv;
+ while (glist->gl_owner) glist = glist->gl_owner;
+ if (glist && glist_isvisible(glist))
+ sprintf(obuf, ".x%x", (int)glist);
+ else
+ obuf[0] = 0;
+ len = 4;
+ }
/* LATER find out when gl_<coords> are updated,
think how to better sync them to Tk. */
else if (!strncmp(&ibuf[1], "x1", 2))
@@ -256,6 +282,11 @@ static char *scriptlet_dedot(t_scriptlet *sp, char *ibuf, char *obuf,
sprintf(obuf, "%d", glist_isgraph(cv));
len = 4;
}
+ else if (!strncmp(&ibuf[1], "dir", 3))
+ {
+ sprintf(obuf, "%s", canvas_getdir(cv)->s_name);
+ len = 4;
+ }
else loud_error(sp->s_owner, "bad field '%s'", &ibuf[1]);
}
}