diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/acme/exec.c | 12 | ||||
-rw-r--r-- | src/cmd/acme/xfid.c | 2 | ||||
-rw-r--r-- | src/cmd/devdraw/cocoa-screen-metal.m | 25 | ||||
-rw-r--r-- | src/cmd/devdraw/cocoa-screen.m | 6 | ||||
-rw-r--r-- | src/cmd/devdraw/cocoa-srv.c | 8 | ||||
-rw-r--r-- | src/cmd/devdraw/x11-srv.c | 1 | ||||
-rw-r--r-- | src/cmd/samterm/main.c | 5 | ||||
-rw-r--r-- | src/libdraw/drawclient.c | 2 | ||||
-rw-r--r-- | src/libdraw/drawfcall.c | 23 |
9 files changed, 74 insertions, 10 deletions
diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c index ad818505..290e0514 100644 --- a/src/cmd/acme/exec.c +++ b/src/cmd/acme/exec.c @@ -195,7 +195,7 @@ execute(Text *t, uint aq0, uint aq1, int external, Text *argt) f |= 2; } aa = getbytearg(argt, TRUE, TRUE, &a); - if(a){ + if(a){ if(strlen(a) > EVENTSIZE){ /* too big; too bad */ free(r); free(aa); @@ -677,7 +677,7 @@ checksha1(char *name, File *f, Dir *d) DigestState *h; uchar out[20]; uchar *buf; - + fd = open(name, OREAD); if(fd < 0) return; @@ -703,7 +703,7 @@ trimspaces(Rune *r, uint *np, int eof) nonspace = 0; w = 0; - n = *np; + n = *np; for(i=0; i<n; i++) { c = r[i]; if(c == '\n') @@ -786,7 +786,11 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname) n = BUFSIZE/UTFmax; bufread(&f->b, q, r, n); nn = n; - if(w->autoindent) + // An attempt at automatically trimming trailing spaces. + // Breaks programs that inspect body file and think it will match on-disk file + // when window is clean. Should apply the changes to the actual window instead. + // Later. + if(0 && w->autoindent) nn = trimspaces(r, &n, q+n==q1); m = snprint(s, BUFSIZE+1, "%.*S", nn, r); sha1((uchar*)s, m, nil, h); diff --git a/src/cmd/acme/xfid.c b/src/cmd/acme/xfid.c index 5aa4a180..9c7be2c0 100644 --- a/src/cmd/acme/xfid.c +++ b/src/cmd/acme/xfid.c @@ -790,10 +790,12 @@ out: }else if(strncmp(p, "nomenu", 6) == 0){ /* turn off automatic menu */ w->filemenu = FALSE; + settag = TRUE; m = 6; }else if(strncmp(p, "menu", 4) == 0){ /* enable automatic menu */ w->filemenu = TRUE; + settag = TRUE; m = 4; }else if(strncmp(p, "cleartag", 8) == 0){ /* wipe tag right of bar */ diff --git a/src/cmd/devdraw/cocoa-screen-metal.m b/src/cmd/devdraw/cocoa-screen-metal.m index 049d1c5c..5fc03172 100644 --- a/src/cmd/devdraw/cocoa-screen-metal.m +++ b/src/cmd/devdraw/cocoa-screen-metal.m @@ -153,6 +153,7 @@ threadmain(int argc, char **argv) id<MTLLibrary> library; MTLRenderPipelineDescriptor *pipelineDesc; NSError *error; + NSArray *allDevices; const NSWindowStyleMask Winstyle = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable @@ -197,8 +198,18 @@ threadmain(int argc, char **argv) [win setContentView:myContent]; [myContent setWantsLayer:YES]; [myContent setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawOnSetNeedsDisplay]; - - device = MTLCreateSystemDefaultDevice(); + + device = nil; + allDevices = MTLCopyAllDevices(); + for(id mtlDevice in allDevices) { + if ([mtlDevice isLowPower] && ![mtlDevice isRemovable]) { + device = mtlDevice; + break; + } + } + if(!device) + device = MTLCreateSystemDefaultDevice(); + commandQueue = [device newCommandQueue]; layer = (DrawLayer *)[myContent layer]; @@ -373,6 +384,11 @@ struct Cursors { return YES; } +- (void)windowDidBecomeKey:(id)arg +{ + [myContent sendmouse:0]; +} + @end @implementation DevDrawView @@ -841,7 +857,6 @@ keycvt(uint code) { switch(code){ case '\r': return '\n'; - case '\b': return 127; case 127: return '\b'; case NSUpArrowFunctionKey: return Kup; case NSDownArrowFunctionKey: return Kdown; @@ -982,6 +997,10 @@ void _flushmemscreen(Rectangle r) { LOG(@"_flushmemscreen(%d,%d,%d,%d)", r.min.x, r.min.y, Dx(r), Dy(r)); + if(!rectinrect(r, Rect(0, 0, texture.width, texture.height))){ + LOG(@"Rectangle is out of bounds, return."); + return; + } @autoreleasepool{ [texture diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m index 2b804c2f..9b404c67 100644 --- a/src/cmd/devdraw/cocoa-screen.m +++ b/src/cmd/devdraw/cocoa-screen.m @@ -541,6 +541,11 @@ _flushmemscreen(Rectangle r) return; rect = NSMakeRect(r.min.x, r.min.y, Dx(r), Dy(r)); + + // This can get blocked behind responding to mouse events, + // which need to acquire the zlock, so let go of it during + // the flush. Perhaps the waitUntilDone:YES is wrong? + zunlock(); [appdelegate performSelectorOnMainThread:@selector(callflushimg:) withObject:[NSValue valueWithRect:rect] @@ -548,6 +553,7 @@ _flushmemscreen(Rectangle r) modes:[NSArray arrayWithObjects: NSRunLoopCommonModes, @"waiting image", nil]]; + zlock(); } static void drawimg(NSRect, uint); diff --git a/src/cmd/devdraw/cocoa-srv.c b/src/cmd/devdraw/cocoa-srv.c index 329dd71f..c1cf5983 100644 --- a/src/cmd/devdraw/cocoa-srv.c +++ b/src/cmd/devdraw/cocoa-srv.c @@ -165,6 +165,14 @@ runmsg(Wsysmsg *m) if(m->arrowcursor) setcursor(nil, nil); else + setcursor(&m->cursor, nil); + replymsg(m); + break; + + case Tcursor2: + if(m->arrowcursor) + setcursor(nil, nil); + else setcursor(&m->cursor, &m->cursor2); replymsg(m); break; diff --git a/src/cmd/devdraw/x11-srv.c b/src/cmd/devdraw/x11-srv.c index 17563f41..81416482 100644 --- a/src/cmd/devdraw/x11-srv.c +++ b/src/cmd/devdraw/x11-srv.c @@ -332,6 +332,7 @@ runmsg(Wsysmsg *m) break; case Tcursor: + case Tcursor2: if(m->arrowcursor) _xsetcursor(nil); else diff --git a/src/cmd/samterm/main.c b/src/cmd/samterm/main.c index a47aa521..78d4fa1b 100644 --- a/src/cmd/samterm/main.c +++ b/src/cmd/samterm/main.c @@ -559,10 +559,11 @@ nontypingkey(int c) case PAGEUP: case RIGHTARROW: case SCROLLKEY: + case CUT: + case COPY: + case PASTE: return 1; } - if(c >= Kcmd) - return 1; return 0; } diff --git a/src/libdraw/drawclient.c b/src/libdraw/drawclient.c index de20d3a3..f0b1d388 100644 --- a/src/libdraw/drawclient.c +++ b/src/libdraw/drawclient.c @@ -296,7 +296,7 @@ _displaycursor(Display *d, Cursor *c, Cursor2 *c2) { Wsysmsg tx, rx; - tx.type = Tcursor; + tx.type = Tcursor2; if(c == nil){ memset(&tx.cursor, 0, sizeof tx.cursor); memset(&tx.cursor2, 0, sizeof tx.cursor2); diff --git a/src/libdraw/drawfcall.c b/src/libdraw/drawfcall.c index e36413b6..09051bbc 100644 --- a/src/libdraw/drawfcall.c +++ b/src/libdraw/drawfcall.c @@ -48,6 +48,7 @@ sizeW2M(Wsysmsg *m) case Rbouncemouse: case Rmoveto: case Rcursor: + case Rcursor2: case Trdkbd: case Rlabel: case Rinit: @@ -64,6 +65,8 @@ sizeW2M(Wsysmsg *m) case Tmoveto: return 4+1+1+4+4; case Tcursor: + return 4+1+1+4+4+2*16+2*16+1; + case Tcursor2: return 4+1+1+4+4+2*16+2*16+4+4+4*32+4*32+1; case Rerror: return 4+1+1+_stringsize(m->error); @@ -108,6 +111,7 @@ convW2M(Wsysmsg *m, uchar *p, uint n) case Rbouncemouse: case Rmoveto: case Rcursor: + case Rcursor2: case Trdkbd: case Rlabel: case Rinit: @@ -141,6 +145,13 @@ convW2M(Wsysmsg *m, uchar *p, uint n) PUT(p+10, m->cursor.offset.y); memmove(p+14, m->cursor.clr, sizeof m->cursor.clr); memmove(p+46, m->cursor.set, sizeof m->cursor.set); + p[78] = m->arrowcursor; + break; + case Tcursor2: + PUT(p+6, m->cursor.offset.x); + PUT(p+10, m->cursor.offset.y); + memmove(p+14, m->cursor.clr, sizeof m->cursor.clr); + memmove(p+46, m->cursor.set, sizeof m->cursor.set); PUT(p+78, m->cursor2.offset.x); PUT(p+82, m->cursor2.offset.y); memmove(p+86, m->cursor2.clr, sizeof m->cursor2.clr); @@ -200,6 +211,7 @@ convM2W(uchar *p, uint n, Wsysmsg *m) case Rbouncemouse: case Rmoveto: case Rcursor: + case Rcursor2: case Trdkbd: case Rlabel: case Rinit: @@ -233,6 +245,13 @@ convM2W(uchar *p, uint n, Wsysmsg *m) GET(p+10, m->cursor.offset.y); memmove(m->cursor.clr, p+14, sizeof m->cursor.clr); memmove(m->cursor.set, p+46, sizeof m->cursor.set); + m->arrowcursor = p[78]; + break; + case Tcursor2: + GET(p+6, m->cursor.offset.x); + GET(p+10, m->cursor.offset.y); + memmove(m->cursor.clr, p+14, sizeof m->cursor.clr); + memmove(m->cursor.set, p+46, sizeof m->cursor.set); GET(p+78, m->cursor2.offset.x); GET(p+82, m->cursor2.offset.y); memmove(m->cursor2.clr, p+86, sizeof m->cursor2.clr); @@ -319,8 +338,12 @@ drawfcallfmt(Fmt *fmt) return fmtprint(fmt, "Rmoveto"); case Tcursor: return fmtprint(fmt, "Tcursor arrow=%d", m->arrowcursor); + case Tcursor2: + return fmtprint(fmt, "Tcursor2 arrow=%d", m->arrowcursor); case Rcursor: return fmtprint(fmt, "Rcursor"); + case Rcursor2: + return fmtprint(fmt, "Rcursor2"); case Trdkbd: return fmtprint(fmt, "Trdkbd"); case Rrdkbd: |