ref: 82b1d4d6c238074e42e8721a4b8f0d3f7e62756d
parent: 54ca86f879d7f131fa76dc448193caa31feed5ad
author: Russ Cox <[email protected]>
date: Mon Oct 17 12:39:16 EDT 2005
More fixes.
--- a/gui-x11/screen.c
+++ b/gui-x11/screen.c
@@ -116,7 +116,9 @@
memimageinit();
terminit();
+ drawqlock();
flushmemscreen(gscreen->r);
+ drawqunlock();
}
uchar*
@@ -1115,9 +1117,12 @@
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 @@
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;
}
--- a/kern/term.c
+++ b/kern/term.c
@@ -55,6 +55,7 @@
char *greet;
Memimage *grey;
+ drawqlock();
back = memwhite;
conscol = memblack;
memfillcolor(gscreen, 0x444488FF);
@@ -88,6 +89,7 @@
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 @@
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 @@
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 @@
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 @@
s += i;
screenputc(buf);
}
+ if(locked)
+ drawqunlock();
screenflush();
unlock(&screenlock);
}