tmerge - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 77ac35832191e456a5d9a3ccff667ab262838303
parent fc9f53d45420e17afd9d1492615ab0038161f405
Author: Russ Cox 
Date:   Tue,  9 Jun 2009 09:26:13 -0700

merge

Diffstat:
  M src/cmd/9term/rcstart.c             |       2 +-
  M src/cmd/acme/rows.c                 |       5 +++--
  M src/cmd/auxstats/FreeBSD.c          |      24 ++++++++++++------------
  M src/cmd/devdraw/osx-screen.c        |      16 +++++++++++++---

4 files changed, 29 insertions(+), 18 deletions(-)
---
diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c
t@@ -77,10 +77,10 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
          */
         notifyoff("sys: window size change");
 
+        putenv("TERM", "9term");
         pid = fork();
         switch(pid){
         case 0:
-                putenv("TERM", "9term");
                 sfd = childpty(fd, slave);
                 dup(sfd, 0);
                 dup(sfd, 1);
diff --git a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c
t@@ -513,7 +513,8 @@ rowload(Row *row, char *file, int initing)
         double percent;
         Biobuf *b, *bout;
         char *buf, *l, *t, *fontname;
-        Rune *r, rune, *fontr;
+        Rune *r, *fontr;
+        int rune;
         Column *c, *c1, *c2;
         uint q0, q1;
         Rectangle r1, r2;
t@@ -739,7 +740,7 @@ rowload(Row *row, char *file, int initing)
                                 rune = Bgetrune(b);
                                 if(rune == '\n')
                                         line++;
-                                if(rune == (Rune)Beof){
+                                if(rune == Beof){
                                         free(r);
                                         Bterm(bout);
                                         free(bout);
diff --git a/src/cmd/auxstats/FreeBSD.c b/src/cmd/auxstats/FreeBSD.c
t@@ -238,27 +238,27 @@ void
 xcpu(int first)
 {
         static int stathz;
-        ulong x[20];
-        struct clockinfo *ci;
+        union {
+                ulong x[20];
+                struct clockinfo ci;
+        } u;
         int n;
 
         if(first){
-                if(rsys("kern.clockrate", (char*)&x, sizeof x) < sizeof ci)
+                if(rsys("kern.clockrate", (char*)u.x, sizeof u.x) < sizeof u.ci)
                         stathz = 128;
-                else{
-                        ci = (struct clockinfo*)x;
-                        stathz = ci->stathz;
-                }
+                else
+                        stathz = u.ci.stathz;
                 return;
         }
 
-        if((n=rsys("kern.cp_time", (char*)x, sizeof x)) < 5*sizeof(ulong))
+        if((n=rsys("kern.cp_time", (char*)u.x, sizeof u.x)) < 5*sizeof(ulong))
                 return;
 
-        Bprint(&bout, "user %lud %d\n", x[CP_USER]+x[CP_NICE], stathz);
-        Bprint(&bout, "sys %lud %d\n", x[CP_SYS], stathz);
-        Bprint(&bout, "cpu %lud %d\n", x[CP_USER]+x[CP_NICE]+x[CP_SYS], stathz);
-        Bprint(&bout, "idle %lud %d\n", x[CP_IDLE], stathz);
+        Bprint(&bout, "user %lud %d\n", u.x[CP_USER]+u.x[CP_NICE], stathz);
+        Bprint(&bout, "sys %lud %d\n", u.x[CP_SYS], stathz);
+        Bprint(&bout, "cpu %lud %d\n", u.x[CP_USER]+u.x[CP_NICE]+u.x[CP_SYS], stathz);
+        Bprint(&bout, "idle %lud %d\n", u.x[CP_IDLE], stathz);
 }
 
 void
diff --git a/src/cmd/devdraw/osx-screen.c b/src/cmd/devdraw/osx-screen.c
t@@ -52,6 +52,7 @@ struct {
         QLock flushlock;
         int active;
         int infullscreen;
+        int kalting;                // last keystroke was Kalt
 } osx;
 
 enum
t@@ -346,8 +347,14 @@ mouseevent(EventRef event)
                 // (Modifiers typed while holding the button go into kbuttons,
                 // but this one does not.)
                 if(but == 1){
-                        if(mod & optionKey)
+                        if(mod & optionKey) {
+                                // Take the ALT away from the keyboard handler.
+                                if(osx.kalting) {
+                                        osx.kalting = 0;
+                                        keystroke(Kalt);
+                                }
                                 but = 2;
+                        }
                         else if(mod & cmdKey)
                                 but = 4;
                 }
t@@ -434,6 +441,7 @@ kbdevent(EventRef event)
         switch(GetEventKind(event)){
         case kEventRawKeyDown:
         case kEventRawKeyRepeat:
+                osx.kalting = 0;
                 if(mod == cmdKey){
                         if(ch == 'F' || ch == 'f'){
                                 if(osx.isfullscreen && msec() - osx.fullscreentime > 500)
t@@ -475,8 +483,10 @@ kbdevent(EventRef event)
 
         case kEventRawKeyModifiersChanged:
                 if(!osx.buttons && !osx.kbuttons){
-                        if(mod == optionKey)
+                        if(mod == optionKey) {
+                                osx.kalting = 1;
                                 keystroke(Kalt);
+                        }
                         break;
                 }
                 
t@@ -813,7 +823,7 @@ setlabel(char *label)
 {
         CFStringRef cs;
 
-        cs = CFStringCreateWithBytes(nil, (uchar*)osx.label, strlen(osx.label), kCFStringEncodingUTF8, false);
+        cs = CFStringCreateWithBytes(nil, (uchar*)label, strlen(label), kCFStringEncodingUTF8, false);
         SetWindowTitleWithCFString(osx.window, cs);
         CFRelease(cs);
 }