optimize if statements
This commit is contained in:
parent
86a970cde1
commit
e3de02d2ce
12
event.c
12
event.c
|
@ -74,22 +74,25 @@ handle_event_buttonpress(XEvent *e)
|
||||||
{
|
{
|
||||||
if(statusbar->position == BarTop
|
if(statusbar->position == BarTop
|
||||||
|| globalconf.screens[screen].statusbar->position == BarBot)
|
|| globalconf.screens[screen].statusbar->position == BarBot)
|
||||||
|
{
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(ev->x >= widget->location && ev->x <= widget->location + widget->width)
|
if(ev->x >= widget->location && ev->x <= widget->location + widget->width)
|
||||||
{
|
{
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(statusbar->position == BarRight)
|
else if(statusbar->position == BarRight)
|
||||||
|
{
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(ev->y >= widget->location && ev->y <= widget->location + widget->width)
|
if(ev->y >= widget->location && ev->y <= widget->location + widget->width)
|
||||||
{
|
{
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(statusbar->position == BarLeft)
|
else
|
||||||
|
{
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(statusbar->width - ev->y >= widget->location
|
if(statusbar->width - ev->y >= widget->location
|
||||||
&& statusbar->width - ev->y <= widget->location + widget->width)
|
&& statusbar->width - ev->y <= widget->location + widget->width)
|
||||||
|
@ -97,6 +100,7 @@ handle_event_buttonpress(XEvent *e)
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||||
|
|
Loading…
Reference in New Issue