This commit is contained in:
Russ Cox 2009-06-09 09:26:13 -07:00
commit 77ac358321
4 changed files with 29 additions and 18 deletions

View file

@ -77,10 +77,10 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
*/ */
notifyoff("sys: window size change"); notifyoff("sys: window size change");
putenv("TERM", "9term");
pid = fork(); pid = fork();
switch(pid){ switch(pid){
case 0: case 0:
putenv("TERM", "9term");
sfd = childpty(fd, slave); sfd = childpty(fd, slave);
dup(sfd, 0); dup(sfd, 0);
dup(sfd, 1); dup(sfd, 1);

View file

@ -513,7 +513,8 @@ rowload(Row *row, char *file, int initing)
double percent; double percent;
Biobuf *b, *bout; Biobuf *b, *bout;
char *buf, *l, *t, *fontname; char *buf, *l, *t, *fontname;
Rune *r, rune, *fontr; Rune *r, *fontr;
int rune;
Column *c, *c1, *c2; Column *c, *c1, *c2;
uint q0, q1; uint q0, q1;
Rectangle r1, r2; Rectangle r1, r2;
@ -739,7 +740,7 @@ rowload(Row *row, char *file, int initing)
rune = Bgetrune(b); rune = Bgetrune(b);
if(rune == '\n') if(rune == '\n')
line++; line++;
if(rune == (Rune)Beof){ if(rune == Beof){
free(r); free(r);
Bterm(bout); Bterm(bout);
free(bout); free(bout);

View file

@ -238,27 +238,27 @@ void
xcpu(int first) xcpu(int first)
{ {
static int stathz; static int stathz;
ulong x[20]; union {
struct clockinfo *ci; ulong x[20];
struct clockinfo ci;
} u;
int n; int n;
if(first){ 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; stathz = 128;
else{ else
ci = (struct clockinfo*)x; stathz = u.ci.stathz;
stathz = ci->stathz;
}
return; 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; return;
Bprint(&bout, "user %lud %d\n", x[CP_USER]+x[CP_NICE], stathz); Bprint(&bout, "user %lud %d\n", u.x[CP_USER]+u.x[CP_NICE], stathz);
Bprint(&bout, "sys %lud %d\n", x[CP_SYS], stathz); Bprint(&bout, "sys %lud %d\n", u.x[CP_SYS], stathz);
Bprint(&bout, "cpu %lud %d\n", x[CP_USER]+x[CP_NICE]+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", x[CP_IDLE], stathz); Bprint(&bout, "idle %lud %d\n", u.x[CP_IDLE], stathz);
} }
void void

View file

@ -52,6 +52,7 @@ struct {
QLock flushlock; QLock flushlock;
int active; int active;
int infullscreen; int infullscreen;
int kalting; // last keystroke was Kalt
} osx; } osx;
enum enum
@ -346,8 +347,14 @@ mouseevent(EventRef event)
// (Modifiers typed while holding the button go into kbuttons, // (Modifiers typed while holding the button go into kbuttons,
// but this one does not.) // but this one does not.)
if(but == 1){ 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; but = 2;
}
else if(mod & cmdKey) else if(mod & cmdKey)
but = 4; but = 4;
} }
@ -434,6 +441,7 @@ kbdevent(EventRef event)
switch(GetEventKind(event)){ switch(GetEventKind(event)){
case kEventRawKeyDown: case kEventRawKeyDown:
case kEventRawKeyRepeat: case kEventRawKeyRepeat:
osx.kalting = 0;
if(mod == cmdKey){ if(mod == cmdKey){
if(ch == 'F' || ch == 'f'){ if(ch == 'F' || ch == 'f'){
if(osx.isfullscreen && msec() - osx.fullscreentime > 500) if(osx.isfullscreen && msec() - osx.fullscreentime > 500)
@ -475,8 +483,10 @@ kbdevent(EventRef event)
case kEventRawKeyModifiersChanged: case kEventRawKeyModifiersChanged:
if(!osx.buttons && !osx.kbuttons){ if(!osx.buttons && !osx.kbuttons){
if(mod == optionKey) if(mod == optionKey) {
osx.kalting = 1;
keystroke(Kalt); keystroke(Kalt);
}
break; break;
} }
@ -813,7 +823,7 @@ setlabel(char *label)
{ {
CFStringRef cs; 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); SetWindowTitleWithCFString(osx.window, cs);
CFRelease(cs); CFRelease(cs);
} }