From 82b1d4d6c238074e42e8721a4b8f0d3f7e62756d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 17 Oct 2005 16:39:16 +0000 Subject: [PATCH] More fixes. --- gui-x11/screen.c | 14 +++++++++++--- kern/term.c | 10 ++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) 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); }