use switch instead of if/elseif/else
This commit is contained in:
parent
2a1aac5b56
commit
3018282169
18
event.c
18
event.c
|
@ -71,28 +71,26 @@ handle_event_buttonpress(XEvent *e)
|
||||||
for(screen = 0; screen < get_screen_count(); screen++)
|
for(screen = 0; screen < get_screen_count(); screen++)
|
||||||
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
|
for(statusbar = globalconf.screens[screen].statusbar; statusbar; statusbar = statusbar->next)
|
||||||
if(statusbar->window == ev->window)
|
if(statusbar->window == ev->window)
|
||||||
{
|
switch(statusbar->position)
|
||||||
if(statusbar->position == Top
|
|
||||||
|| globalconf.screens[screen].statusbar->position == Bottom)
|
|
||||||
{
|
{
|
||||||
|
case Top:
|
||||||
|
case Bottom:
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(ev->x >= widget->area.x && ev->x <= widget->area.x + widget->area.width)
|
if(ev->x >= widget->area.x && ev->x <= widget->area.x + widget->area.width)
|
||||||
{
|
{
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if(statusbar->position == Right)
|
case Right:
|
||||||
{
|
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(ev->y >= widget->area.x && ev->y <= widget->area.x + widget->area.width)
|
if(ev->y >= widget->area.x && ev->y <= widget->area.x + widget->area.width)
|
||||||
{
|
{
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
{
|
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(statusbar->width - ev->y >= widget->area.x
|
if(statusbar->width - ev->y >= widget->area.x
|
||||||
&& statusbar->width - ev->y <= widget->area.x + widget->area.width)
|
&& statusbar->width - ev->y <= widget->area.x + widget->area.width)
|
||||||
|
@ -100,8 +98,8 @@ handle_event_buttonpress(XEvent *e)
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
if((c = get_client_bywin(globalconf.clients, ev->window)))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue