Commit Diff


commit - fc9f53d45420e17afd9d1492615ab0038161f405
commit + 77ac35832191e456a5d9a3ccff667ab262838303
blob - c137b8f89f05d8075af127ecae443bd451f2c9c3
blob + 4d64349c6b48faa56fe11c7d2a8281b093e22725
--- src/cmd/9term/rcstart.c
+++ src/cmd/9term/rcstart.c
@@ -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);
blob - ee41bfee6c828adcbeecd2dd64dcae7c10396f75
blob + 51f3e1c5f5c978eef5cdff130e4fd50c30215236
--- src/cmd/acme/rows.c
+++ src/cmd/acme/rows.c
@@ -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;
@@ -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);
blob - 19ae96b1d7a624ccd294ca39e22deec42f0659b9
blob + a6b7a8d690847e8c934f3fa116cb92161469dd10
--- src/cmd/auxstats/FreeBSD.c
+++ src/cmd/auxstats/FreeBSD.c
@@ -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
blob - 8e3dd806a4c326d513d864c250607e8c14c8eded
blob + 8939ee3170390686f911b3b3292f314acf24dbeb
--- src/cmd/devdraw/osx-screen.c
+++ src/cmd/devdraw/osx-screen.c
@@ -52,6 +52,7 @@ struct {
 	QLock flushlock;
 	int active;
 	int infullscreen;
+	int kalting;		// last keystroke was Kalt
 } osx;
 
 enum
@@ -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;
 		}
@@ -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)
@@ -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;
 		}
 		
@@ -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);
 }