menu.c: scroll wheel virt switch wraps around
This commit is contained in:
parent
7a8843267f
commit
9323cafb65
1 changed files with 20 additions and 7 deletions
27
menu.c
27
menu.c
|
@ -155,16 +155,29 @@ void button(XButtonEvent* e) {
|
||||||
case Button3:
|
case Button3:
|
||||||
break;
|
break;
|
||||||
case Button4:
|
case Button4:
|
||||||
/* scroll up changes to previous virtual screen */
|
/* scroll up changes to previous virtual screen, wraps around */
|
||||||
if (!c && e->type == ButtonPress)
|
if (!c && e->type == ButtonPress)
|
||||||
if (numvirtuals > 1 && virt > 0)
|
{
|
||||||
switch_to(virt - 1);
|
if (numvirtuals > 1) {
|
||||||
|
if (virt > 0) {
|
||||||
|
switch_to(virt - 1);
|
||||||
|
} else {
|
||||||
|
switch_to(numvirtuals - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case Button5:
|
case Button5:
|
||||||
/* scroll down changes to next virtual screen */
|
/* scroll down changes to next virtual screen, wraps around */
|
||||||
if (!c && e->type == ButtonPress)
|
if (!c && e->type == ButtonPress) {
|
||||||
if (numvirtuals > 1 && virt < numvirtuals - 1)
|
if (numvirtuals > 1) {
|
||||||
switch_to(virt + 1);
|
if (virt < numvirtuals - 1) {
|
||||||
|
switch_to(virt + 1);
|
||||||
|
} else {
|
||||||
|
switch_to(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue