Add ClickImage click

This commit is contained in:
speedie 2023-07-03 23:06:33 +02:00
parent 247d5e768b
commit 7bb81a26b8
4 changed files with 12 additions and 0 deletions

View file

@ -685,6 +685,9 @@ static ClickType ctp[] = {
{ "ClickNumber", ClickNumber },
{ "ClickCaps", ClickCaps },
{ "ClickMode", ClickMode },
#if USEIMAGE
{ "ClickImage", ClickImage },
#endif
};
static void conf_init(void);

View file

@ -318,6 +318,10 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
click = ClickItem;
}
}
#if USEIMAGE
} else if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) - MAX((imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ex <= (x - MAX((imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
click = ClickImage;
#endif
}
}
} else if (matches) { // a single line, meaning it could be arrows too, so we check that here

View file

@ -102,6 +102,10 @@ void buttonpress_x11(XEvent *e) {
click = ClickItem;
}
}
#if USEIMAGE
} else if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ev->x <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
click = ClickImage;
#endif
}
}
} else if (matches) { // a single line, meaning it could be arrows too, so we check that here

View file

@ -99,6 +99,7 @@ enum {
ClickNumber,
ClickCaps,
ClickMode,
ClickImage,
};
struct item {