URI: 
       tdevdraw: OS X alt key support - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 81a90f898bf58852ca414ae612751e6cff06566c
   DIR parent 8cb7983083a94e2bdedcd24ca4ba0ccbefcf61b8
  HTML Author: Russ Cox <rsc@swtch.com>
       Date:   Tue,  1 Jul 2008 20:45:49 -0400
       
       devdraw: OS X alt key support
       
       Diffstat:
         M src/cmd/devdraw/osx-srv.c           |      40 +++++++++++++++++++++++++++++--
       
       1 file changed, 38 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/src/cmd/devdraw/osx-srv.c b/src/cmd/devdraw/osx-srv.c
       t@@ -395,9 +395,9 @@ mousetrack(int x, int y, int b, int ms)
                matchmouse();
                zunlock();
        }
       -        
       +
        void
       -keystroke(int c)
       +kputc(int c)
        {
                zlock();
                kbd.r[kbd.wi++] = c;
       t@@ -408,3 +408,39 @@ keystroke(int c)
                matchkbd();
                zunlock();
        }
       +
       +void
       +keystroke(int c)
       +{
       +        static Rune k[10];
       +        static int alting, nk;
       +        int i;
       +
       +        if(c == Kalt){
       +                alting = !alting;
       +                return;
       +        }
       +        if(!alting){
       +                kputc(c);
       +                return;
       +        }
       +        if(nk >= nelem(k))      // should not happen
       +                nk = 0;
       +        k[nk++] = c;
       +        c = _latin1(k, nk);
       +        if(c > 0){
       +                alting = 0;
       +                kputc(c);
       +                nk = 0;
       +                return;
       +        }
       +        if(c == -1){
       +                alting = 0;
       +                for(i=0; i<nk; i++)
       +                        kputc(k[i]);
       +                nk = 0;
       +                return;
       +        }
       +        // need more input
       +        return;
       +}