n = atoi(pd[i].name);
if(n == mywinid)
continue;
- if(readfile(label, sizeof(label), "/dev/wsys/%d/label", n) <= 0)
+ if(readfile(label, sizeof(label), "/dev/wsys/%d/label", n) < 0)
continue;
if(exclude != nil && regexec(exclude,label,nil,0))
continue;
char buf[512], fname[128];
int n, fd;
- buf[0] = 0;
- n = eenter("label?", buf, sizeof(buf), &m);
+ snprint(buf, sizeof(buf), "%s", w.label);
+ n = eenter(nil, buf, sizeof(buf), &m);
if(n <= 0)
return 0;
sprint(fname, "/dev/wsys/%d/label", w.n);
return label(win[i], m);
case 4:
return unhide(win[i]);
+ default:
+ return 0;
}
- return 1;
-}
-
-Cursor crosscursor = {
- {-7, -7},
- {0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0,
- 0x03, 0xC0, 0x03, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xC0, 0x03, 0xC0,
- 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, },
- {0x00, 0x00, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
- 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x7F, 0xFE,
- 0x7F, 0xFE, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
- 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00, }
-};
-
-void
-kbdlabel(void)
-{
- Mouse m;
- int i;
-
- esetcursor(&crosscursor);
- do
- m = emouse();
- while((m.buttons & 7) == 0);
- do
- m = emouse();
- while((m.buttons & 7) == 1);
- esetcursor(nil);
- if((m.buttons & 7) != 0)
- return;
- for(i=0; i<nwin; i++)
- if(ptinrect(m.xy, win[i].r))
- break;
- if(i == nwin)
- return;
- label(win[i], m);
}
void
case Ekeyboard:
if(e.kbdc==Kdel || e.kbdc=='q')
exits(0);
- if(e.kbdc == 'l')
- kbdlabel();
break;
case Emouse:
if(click(e.mouse) == 0)