diff --git a/gui-x11/screen.c b/gui-x11/screen.c index 17ad260..03a97dc 100644 --- a/gui-x11/screen.c +++ b/gui-x11/screen.c @@ -116,7 +116,9 @@ screeninit(void) memimageinit(); terminit(); + drawqlock(); flushmemscreen(gscreen->r); + drawqunlock(); } uchar* @@ -1115,9 +1117,12 @@ xselect(XEvent *e, Display *xd) XSelectionRequestEvent *xe; Atom a[4]; + if(e->xany.type != SelectionRequest) + return; + memset(&r, 0, sizeof r); xe = (XSelectionRequestEvent*)e; -if(0) fprint(2, "xselect target=%d requestor=%d property=%d selection=%d\n", +if(0) iprint("xselect target=%d requestor=%d property=%d selection=%d\n", xe->target, xe->requestor, xe->property, xe->selection); r.xselection.property = xe->property; if(xe->target == targets){ @@ -1135,9 +1140,12 @@ if(0) fprint(2, "xselect target=%d requestor=%d property=%d selection=%d\n", 8, PropModeReplace, (uchar*)clip.buf, strlen(clip.buf)); qunlock(&clip.lk); }else{ + iprint("get %d\n", xe->target); name = XGetAtomName(xd, xe->target); - if(strcmp(name, "TIMESTAMP") != 0) - fprint(2, "%s: cannot handle selection request for '%s' (%d)\n", argv0, name, (int)xe->target); + if(name == nil) + iprint("XGetAtomName failed\n"); + else if(strcmp(name, "TIMESTAMP") != 0) + iprint("%s: cannot handle selection request for '%s' (%d)\n", argv0, name, (int)xe->target); r.xselection.property = None; } diff --git a/kern/term.c b/kern/term.c index f1e93ea..b582e88 100644 --- a/kern/term.c +++ b/kern/term.c @@ -55,6 +55,7 @@ screenwin(void) char *greet; Memimage *grey; + drawqlock(); back = memwhite; conscol = memblack; memfillcolor(gscreen, 0x444488FF); @@ -88,6 +89,7 @@ screenwin(void) curpos = window.min; window.max.y = window.min.y+((window.max.y-window.min.y)/h)*h; flushmemscreen(gscreen->r); + drawqunlock(); } void @@ -108,6 +110,7 @@ scroll(void) Point p; Rectangle r; + drawqlock(); o = 8*h; r = Rpt(window.min, Pt(window.max.x, window.max.y-o)); p = Pt(window.min.x, window.min.y+o); @@ -115,8 +118,8 @@ scroll(void) r = Rpt(Pt(window.min.x, window.max.y-o), window.max); memimagedraw(gscreen, r, back, ZP, nil, ZP, S); flushmemscreen(gscreen->r); - curpos.y -= o; + drawqunlock(); } static void @@ -181,11 +184,12 @@ screenputc(char *buf) static void termscreenputs(char *s, int n) { - int i; + int i, locked; Rune r; char buf[4]; lock(&screenlock); + locked = drawcanqlock(); while(n > 0){ i = chartorune(&r, s); if(i == 0){ @@ -199,6 +203,8 @@ termscreenputs(char *s, int n) s += i; screenputc(buf); } + if(locked) + drawqunlock(); screenflush(); unlock(&screenlock); }