taglist now supports clicks if statusbar is right/left
This commit is contained in:
parent
65fe4e8933
commit
8485c13b1b
|
@ -119,11 +119,12 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
|||
|
||||
for(b = widget->buttons; b; b = b->next)
|
||||
if(ev->button == b->button && CLEANMASK(ev->state) == b->mod && b->func)
|
||||
{
|
||||
if(widget->statusbar->position == BarTop
|
||||
|| widget->statusbar->position == BarBot)
|
||||
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
||||
{
|
||||
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||
if(widget->statusbar->position == BarTop
|
||||
|| widget->statusbar->position == BarBot)
|
||||
if(ev->x >= widget->location + prev_width
|
||||
&& ev->x <= widget->location + prev_width + width)
|
||||
{
|
||||
|
@ -133,6 +134,35 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
|||
}
|
||||
prev_width += width;
|
||||
}
|
||||
else if(widget->statusbar->position == BarRight)
|
||||
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
||||
{
|
||||
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||
if(ev->y >= widget->location + prev_width
|
||||
&& ev->y <= widget->location + prev_width + width)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%d", i);
|
||||
b->func(widget->statusbar->screen, buf);
|
||||
return;
|
||||
}
|
||||
prev_width += width;
|
||||
}
|
||||
else
|
||||
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
||||
{
|
||||
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||
if(widget->statusbar->width - ev->y >= widget->location + prev_width
|
||||
&& widget->statusbar->width - ev->y <= widget->location + prev_width + width)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%d", i);
|
||||
b->func(widget->statusbar->screen, buf);
|
||||
return;
|
||||
}
|
||||
prev_width += width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Widget *
|
||||
|
|
Loading…
Reference in New Issue