Allow raw switch while reader is reading. [rsc] --rw-rw-r-- M 84748 glenda sys 22495 Oct 31 06:48 sys/src/9/port/devcons.c /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devcons.c:962,977 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devcons.c:962,973 buf[n] = 0; for(a = buf; a;){ if(strncmp(a, "rawon", 5) == 0){ - qlock(&kbd); kbd.raw = 1; /* clumsy hack - wake up reader */ ch = 0; qwrite(kbdq, &ch, 1); - qunlock(&kbd); } else if(strncmp(a, "rawoff", 6) == 0){ - qlock(&kbd); kbd.raw = 0; - qunlock(&kbd); } else if(strncmp(a, "ctlpon", 6) == 0){ kbd.ctlpoff = 0; } else if(strncmp(a, "ctlpoff", 7) == 0){ [rsc] --rw-rw-r-- M 84748 glenda sys 12382 Oct 31 14:52 sys/src/9/pc/kbd.c /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:6,11 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:6,13 #include "io.h" #include "../port/error.h" + extern void mousetrack(int, int, int, int); + enum { Data= 0x60, /* data port */ /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:22,28 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:24,29 Cmd= 0x64, /* command port (write only) */ Spec= 0xF800, /* Unicode private space */ - PF= Spec|0x20, /* num pad function key */ View= Spec|0x00, /* view (shift window up) */ KF= 0xF000, /* function key (begin Unicode private space) */ /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:34,39 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:35,41 Num= Spec|0x65, Middle= Spec|0x66, Altgr= Spec|0x67, + Kmouse= Spec|0x100, No= 0x00, /* peter */ Home= KF|13, /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:168,173 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:170,176 }; int mouseshifted; + int kbdbuttons; static Lock i8042lock; static uchar ccc; /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:289,294 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:292,311 return i; } + struct { + int esc1; + int esc2; + int alt; + int altgr; + int caps; + int ctl; + int num; + int shift; + int collecting; + int nk; + Rune kc[5]; + } kbscan; + /* * keyboard interrupt */ /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:296,305 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:313,318 i8042intr(Ureg*, void*) { int s, c, i; - static int esc1, esc2; - static int alt, altgr, caps, ctl, num, shift; - static int collecting, nk; - static Rune kc[5]; int keyup; /* /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:323,329 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:336,342 */ if(s & Minready){ if(auxputc != nil) - auxputc(c, shift); + auxputc(c, kbscan.shift); return; } /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:332,341 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:345,354 * of a 3 character sequence (on the safari) */ if(c == 0xe0){ - esc1 = 1; + kbscan.esc1 = 1; return; } else if(c == 0xe1){ - esc2 = 2; + kbscan.esc2 = 2; return; } /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:348,369 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:361,382 return; } - if(esc1){ + if(kbscan.esc1){ c = kbtabesc1[c]; - esc1 = 0; - } else if(esc2){ - esc2--; + kbscan.esc1 = 0; + } else if(kbscan.esc2){ + kbscan.esc2--; return; - } else if(shift) + } else if(kbscan.shift) c = kbtabshift[c]; - else if(altgr) + else if(kbscan.altgr) c = kbtabaltgr[c]; - else if(ctl) + else if(kbscan.ctl) c = kbtabctrl[c]; else c = kbtab[c]; - if(caps && c<='z' && c>='a') + if(kbscan.caps && c<='z' && c>='a') c += 'A' - 'a'; /* /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:372,389 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:385,410 if(keyup){ switch(c){ case Latin: - alt = 0; + kbscan.alt = 0; break; case Shift: - shift = 0; + kbscan.shift = 0; mouseshifted = 0; break; case Ctrl: - ctl = 0; + kbscan.ctl = 0; break; case Altgr: - altgr = 0; + kbscan.altgr = 0; break; + case Kmouse|1: + case Kmouse|2: + case Kmouse|3: + case Kmouse|4: + case Kmouse|5: + kbdbuttons &= ~(1<<(c-Kmouse-1)); + mousetrack(0, 0, 0, TK2MS(MACHP(0)->ticks)); + break; } return; } /n/sourcesdump/2005/1031/plan9/sys/src/9/pc/kbd.c:392,432 - /n/sourcesdump/2005/1101/plan9/sys/src/9/pc/kbd.c:413,453 * normal character */ if(!(c & (Spec|KF))){ - if(ctl) - if(alt && c == Del) + if(kbscan.ctl) + if(kbscan.alt && c == Del) exit(0); - if(!collecting){ + if(!kbscan.collecting){ kbdputc(kbdq, c); return; } - kc[nk++] = c; - c = latin1(kc, nk); + kbscan.kc[kbscan.nk++] = c; + c = latin1(kbscan.kc, kbscan.nk); if(c < -1) /* need more keystrokes */ return; if(c != -1) /* valid sequence */ kbdputc(kbdq, c); else /* dump characters */ - for(i=0; iticks)); return; } } [rsc] --rw-rw-r-- M 84748 presotto sys 3064 Oct 31 08:04 sys/src/9/port/devkbmap.c /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devkbmap.c:118,123 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devkbmap.c:118,126 lp = line; continue; } + lp = line; + while(*lp == ' ' || *lp == '\t') + lp++; m = strtoul(line, &lp, 0); key = strtoul(lp, &lp, 0); while(*lp == ' ' || *lp == '\t') /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devkbmap.c:125,130 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devkbmap.c:128,141 r = 0; if(*lp == '\'' && lp[1]) chartorune(&r, lp+1); + else if(*lp == '^' && lp[1]){ + chartorune(&r, lp+1); + if(0x40 <= r && r < 0x60) + r -= 0x40; + else + error(Ebadarg); + }else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '5')) + r = 0xF900+lp[1]-'0'; else if(*lp>='0' && *lp<='9') /* includes 0x... */ r = strtoul(lp, &lp, 0); else [rsc] --rw-rw-r-- M 84748 glenda sys 13327 Oct 31 12:38 sys/src/9/port/devmouse.c /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devmouse.c:38,43 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devmouse.c:38,45 int track; /* dx & dy updated */ int redraw; /* update cursor on screen */ ulong lastcounter; /* value when /dev/mouse read */ + ulong lastresize; + ulong resize; Rendez r; Ref; QLock; /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devmouse.c:70,75 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devmouse.c:72,78 Mouseinfo mouse; Cursorinfo cursor; int mouseshifted; + int kbdbuttons; Cursor curs; void Cursortocursor(Cursor*); /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devmouse.c:163,168 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devmouse.c:166,172 } mouse.open = 1; mouse.ref++; + mouse.lastresize = mouse.resize; unlock(&mouse); break; case Qmousein: /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devmouse.c:286,291 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devmouse.c:290,299 mouse.lastcounter = m.counter; if(n > 1+4*12) n = 1+4*12; + if(mouse.lastresize != mouse.resize){ + mouse.lastresize = mouse.resize; + buf[0] = 'r'; + } memmove(va, buf, n); return n; } /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devmouse.c:561,567 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devmouse.c:569,575 lastb = mouse.buttons; mouse.xy = Pt(x, y); - mouse.buttons = b; + mouse.buttons = b|kbdbuttons; mouse.redraw = 1; mouse.counter++; mouse.msec = msec; /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devmouse.c:719,725 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devmouse.c:727,734 int mousechanged(void*) { - return mouse.lastcounter != mouse.counter; + return mouse.lastcounter != mouse.counter || + mouse.lastresize != mouse.resize; } Point /n/sourcesdump/2005/1031/plan9/sys/src/9/port/devmouse.c:737,739 - /n/sourcesdump/2005/1101/plan9/sys/src/9/port/devmouse.c:746,759 else mouse.maxacc = mouse.acceleration; } + + /* + * notify reader that screen has been resized + */ + void + mouseresize(void) + { + mouse.resize++; + wakeup(&mouse.r); + } + [rsc] --rw-rw-r-- M 84748 glenda sys 12382 Oct 31 14:52 sys/src/9/pc/kbd.c