ref: c85e26cb9418d8d6420122e9fe387c41583c2ef5
parent: 211e5d36cc5b2c2dea557f04d99a8519f906781d
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Thu Aug 9 00:03:33 EDT 2012
mothra: avoid eenter deadlock on resize
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -236,6 +236,17 @@
esetcursor(0);
}
+void drawlock(int dolock){+ static int ref = 0;
+ if(dolock){+ if(ref++ == 0)
+ lockdisplay(display);
+ } else {+ if(--ref == 0)
+ unlockdisplay(display);
+ }
+}
+
void scrollto(char *tag);
extern char *mtpt; /* url */
@@ -315,7 +326,7 @@
unlockdisplay(display);
eresized(0);
- lockdisplay(display);
+ drawlock(1);
if(url && url[0])
geturl(url, -1, 1, 0);
@@ -336,9 +347,9 @@
}
flushimage(display, 1);
- unlockdisplay(display);
+ drawlock(0);
i=event(&e);
- lockdisplay(display);
+ drawlock(1);
switch(i){case Ekick:
@@ -441,7 +452,7 @@
void eresized(int new){Rectangle r;
- lockdisplay(display);
+ drawlock(1);
if(new && getwindow(display, Refnone) == -1) {fprint(2, "getwindow: %r\n");
exits("getwindow");@@ -451,7 +462,8 @@
plpack(alt, r);
draw(screen, r, display->white, 0, ZP);
pldraw(root, screen);
- unlockdisplay(display);
+ flushimage(display, 1);
+ drawlock(0);
}
void *emalloc(int n){void *v;
@@ -611,7 +623,7 @@
geturl(s, -1, 0, 0);
else switch(c = s[0]){default:
- message("Unknown command %s, type h for help", s);+ message("Unknown command %s", s);break;
case 'a':
s = arg(s);
@@ -885,9 +897,9 @@
if(i >= NWWW){/* wait for the reader to finish the document */
while(!w->finished && !w->alldone){- unlockdisplay(display);
+ drawlock(0);
sleep(10);
- lockdisplay(display);
+ drawlock(1);
}
freetext(w->text);
freeform(w->form);
--
⑨