trio: add alt-tab for cycling windows - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit c4da64274d01d25fe699f888ce7ad6311bf4ef8b
parent 93ee60c3691d2b4699e970d63363500cade26264
Author: Mathieu Lonjaret 
Date:   Thu, 18 Feb 2010 22:34:37 -0800

rio: add alt-tab for cycling windows

R=rsc
CC=codebot
http://codereview.appspot.com/207093

Diffstat:
  M src/cmd/rio/client.c                |      12 ++++++------
  M src/cmd/rio/key.c                   |       7 ++++---

2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/cmd/rio/client.c b/src/cmd/rio/client.c
t@@ -257,15 +257,15 @@ shuffle(int up)
         
         if(clients == 0 || clients->next == 0)
                 return;
-        if(up){
+        if(!up){
+                c = 0;
                 /*for(c=clients; c->next; c=c->next) */
                 /*        ; */
                 for(l=&clients; (*l)->next; l=&(*l)->next)
-                        ;
-                c = *l;
-                *l = 0;
-                c->next = clients;
-                clients = c;
+                        if ((*l)->state == 1)
+                                c = *l;
+                if (c == 0)
+                        return;
                 XMapRaised(dpy, c->parent);
                 top(c);
                 active(c);
diff --git a/src/cmd/rio/key.c b/src/cmd/rio/key.c
t@@ -17,7 +17,7 @@ enum
         GrabAltAny
 };
 
-static int tabcode = 0x17;
+/*static int tabcode = 0x17; */
 /*static int altcode = 0x40; */
 /*static int pgupcode = 0x63; */
 /*static int pgdowncode = 0x69; */
t@@ -28,6 +28,7 @@ void
 keysetup(void)
 {
         int i;
+        int tabcode = XKeysymToKeycode(dpy, XK_Tab);
 
         for(i=0; ikeycode == tabcode)
+        int tabcode = XKeysymToKeycode(dpy, XK_Tab);
+        if(e->keycode == tabcode && (e->state&Mod1Mask) == (1<<3))
                 alttab(e->state&ShiftMask);
         XAllowEvents(dpy, SyncKeyboard, e->time);
 }