comparison layout.c @ 2:de6bb7885c97

add right-click eventon layout icon to go to previous layout
author pang@hit-nxdomain.opendns.com
date Tue, 24 Mar 2009 12:52:45 -0700
parents 7024076fa948
children faa4cb9d7bd6
comparison
equal deleted inserted replaced
0:1bcc3572197d 1:6b3f27f35280
425 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 425 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
426 } 426 }
427 427
428 void 428 void
429 setlayout(Arg *arg) { 429 setlayout(Arg *arg) {
430 unsigned int i; 430 int i;
431 431
432 if(arg->i == -1) { 432 if(arg->i < 0) {
433 for(i = 0; i < nlayouts && lt != &layout[i]; i++); 433 for(i = 0; i < nlayouts && lt != &layout[i]; i++);
434 if(i == nlayouts - 1) 434 if(arg->i == -1)
435 lt = &layout[0]; 435 lt = &layout[(i + 1) % nlayouts];
436 else 436 else if(arg->i == -2)
437 lt = &layout[++i]; 437 lt = &layout[(i - 1) >= 0 ? i - 1 : nlayouts - 1];
438 } 438 }
439 else { 439 else {
440 if(arg->i < 0 || arg->i >= nlayouts) 440 if(arg->i < 0 || arg->i >= nlayouts)
441 return; 441 return;
442 lt = &layout[arg->i]; 442 lt = &layout[arg->i];