rio: add alt-tab for cycling windows

R=rsc
CC=codebot
http://codereview.appspot.com/207093
This commit is contained in:
Mathieu Lonjaret 2010-02-18 22:34:37 -08:00 committed by Russ Cox
parent 93ee60c369
commit c4da64274d
2 changed files with 10 additions and 9 deletions

View file

@ -257,15 +257,15 @@ shuffle(int up)
if(clients == 0 || clients->next == 0) if(clients == 0 || clients->next == 0)
return; return;
if(up){ if(!up){
c = 0;
/*for(c=clients; c->next; c=c->next) */ /*for(c=clients; c->next; c=c->next) */
/* ; */ /* ; */
for(l=&clients; (*l)->next; l=&(*l)->next) for(l=&clients; (*l)->next; l=&(*l)->next)
; if ((*l)->state == 1)
c = *l; c = *l;
*l = 0; if (c == 0)
c->next = clients; return;
clients = c;
XMapRaised(dpy, c->parent); XMapRaised(dpy, c->parent);
top(c); top(c);
active(c); active(c);

View file

@ -17,7 +17,7 @@ enum
GrabAltAny GrabAltAny
}; };
static int tabcode = 0x17; /*static int tabcode = 0x17; */
/*static int altcode = 0x40; */ /*static int altcode = 0x40; */
/*static int pgupcode = 0x63; */ /*static int pgupcode = 0x63; */
/*static int pgdowncode = 0x69; */ /*static int pgdowncode = 0x69; */
@ -28,6 +28,7 @@ void
keysetup(void) keysetup(void)
{ {
int i; int i;
int tabcode = XKeysymToKeycode(dpy, XK_Tab);
for(i=0; i<num_screens; i++){ for(i=0; i<num_screens; i++){
XGrabKey(dpy, tabcode, Mod1Mask, screens[i].root, 0, GrabModeSync, GrabModeAsync); XGrabKey(dpy, tabcode, Mod1Mask, screens[i].root, 0, GrabModeSync, GrabModeAsync);
@ -44,8 +45,8 @@ keypress(XKeyEvent *e)
/* /*
* process key press here * process key press here
*/ */
if(0) int tabcode = XKeysymToKeycode(dpy, XK_Tab);
if(e->keycode == tabcode) if(e->keycode == tabcode && (e->state&Mod1Mask) == (1<<3))
alttab(e->state&ShiftMask); alttab(e->state&ShiftMask);
XAllowEvents(dpy, SyncKeyboard, e->time); XAllowEvents(dpy, SyncKeyboard, e->time);
} }