diff options
-rw-r--r-- | src/libdraw/init.c | 4 | ||||
-rw-r--r-- | src/libdraw/keyboard.c | 1 | ||||
-rw-r--r-- | src/libdraw/mouse.c | 2 | ||||
-rw-r--r-- | src/libdraw/x11-draw.c | 8 | ||||
-rw-r--r-- | src/libdraw/x11-keyboard.c | 8 | ||||
-rw-r--r-- | src/libdraw/x11-mouse.c | 14 |
6 files changed, 20 insertions, 17 deletions
diff --git a/src/libdraw/init.c b/src/libdraw/init.c index 0cf590d8..f0ee94fb 100644 --- a/src/libdraw/init.c +++ b/src/libdraw/init.c @@ -10,7 +10,7 @@ int _drawdebug; static char deffontname[] = "*default*"; Screen *_screen; -int debuglockdisplay = 0; +int debuglockdisplay = 1; static void drawshutdown(void) @@ -34,6 +34,7 @@ initdraw(void (*error)(Display*, char*), char *fontname, char *label) if(display == nil) return -1; + lockdisplay(display); display->image = display->screenimage; screen = display->screenimage; @@ -113,7 +114,6 @@ closedisplay(Display *disp) free(disp->windir); freeimage(disp->white); freeimage(disp->black); - qunlock(&disp->qlock); free(disp); } diff --git a/src/libdraw/keyboard.c b/src/libdraw/keyboard.c index 5ab911ab..0a8ec010 100644 --- a/src/libdraw/keyboard.c +++ b/src/libdraw/keyboard.c @@ -91,6 +91,7 @@ Error2: } free(t); kc->c = chancreate(sizeof(Rune), 20); + chansetname(kc->c, "kbdc"); proccreate(_ioproc, kc, 4096); return kc; } diff --git a/src/libdraw/mouse.c b/src/libdraw/mouse.c index e7b8f890..3b3cbb6b 100644 --- a/src/libdraw/mouse.c +++ b/src/libdraw/mouse.c @@ -118,7 +118,9 @@ initmouse(char *file, Image *i) free(t); mc->image = i; mc->c = chancreate(sizeof(Mouse), 0); + chansetname(mc->c, "mousec"); mc->resizec = chancreate(sizeof(int), 2); + chansetname(mc->resizec, "resizec"); proccreate(_ioproc, mc, 4096); return mc; } diff --git a/src/libdraw/x11-draw.c b/src/libdraw/x11-draw.c index 0a28813d..b80bd2e9 100644 --- a/src/libdraw/x11-draw.c +++ b/src/libdraw/x11-draw.c @@ -23,11 +23,11 @@ memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, /* only fetch dst data if we need it */ if((par->state&(Simplemask|Fullmask)) != (Simplemask|Fullmask)) - _xgetxdata(dst, par->r); + _xgetxdata(par->dst, par->r); /* always fetch source and mask */ - _xgetxdata(src, par->sr); - _xgetxdata(mask, par->mr); + _xgetxdata(par->src, par->sr); + _xgetxdata(par->mask, par->mr); /* now can run memimagedraw on the in-memory bits */ _memimagedraw(par); @@ -36,7 +36,7 @@ memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, return; /* put bits back on x server */ - _xputxdata(dst, par->r); + _xputxdata(par->dst, par->r); } static int diff --git a/src/libdraw/x11-keyboard.c b/src/libdraw/x11-keyboard.c index bee0f410..1a4d0a3b 100644 --- a/src/libdraw/x11-keyboard.c +++ b/src/libdraw/x11-keyboard.c @@ -45,9 +45,7 @@ _ioproc(void *arg) fd = XConnectionNumber(_x.kbdcon); XSelectInput(_x.kbdcon, _x.drawable, KeyPressMask); for(;;){ - while(XCheckWindowEvent(_x.kbdcon, _x.drawable, KeyPressMask, &xevent) == False){ - threadfdwait(fd, 'r'); - } + XWindowEvent(_x.kbdcon, _x.drawable, KeyPressMask, &xevent); switch(xevent.type){ case KeyPress: i = _xtoplan9kbd(&xevent); @@ -69,12 +67,12 @@ initkeyboard(char *file) { Keyboardctl *kc; - threadfdwaitsetup(); kc = mallocz(sizeof(Keyboardctl), 1); if(kc == nil) return nil; kc->c = chancreate(sizeof(Rune), 20); - threadcreate(_ioproc, kc, 32768); + chansetname(kc->c, "kbdc"); + proccreate(_ioproc, kc, 32768); return kc; } diff --git a/src/libdraw/x11-mouse.c b/src/libdraw/x11-mouse.c index 4827423c..936b5628 100644 --- a/src/libdraw/x11-mouse.c +++ b/src/libdraw/x11-mouse.c @@ -50,7 +50,7 @@ static void _ioproc(void *arg) { - int fd, one; + int fd, one, buttons; Atom a; ulong mask; Mouse m; @@ -65,9 +65,8 @@ _ioproc(void *arg) mask = MouseMask|ExposureMask|StructureNotifyMask; XSelectInput(_x.mousecon, _x.drawable, mask); fd = XConnectionNumber(_x.mousecon); + buttons = 0; for(;;){ - while(XPending(_x.mousecon) == False) - threadfdwait(fd, 'r'); XNextEvent(_x.mousecon, &xevent); switch(xevent.type){ case Expose: @@ -94,14 +93,16 @@ _ioproc(void *arg) case ButtonRelease: case MotionNotify: /* If the motion notifications are backing up, skip over some. */ - if(xevent.type == MotionNotify){ + if(0 && xevent.type == MotionNotify){ while(XCheckWindowEvent(_x.mousecon, _x.drawable, MouseMask, &xevent)){ if(xevent.type != MotionNotify) break; } } + m.buttons = buttons; if(_xtoplan9mouse(_x.mousecon, &xevent, &m) < 0) continue; + buttons = m.buttons; send(mc->c, &m); /* * mc->Mouse is updated after send so it doesn't have wrong value if we block during send. @@ -133,13 +134,14 @@ initmouse(char *file, Image *i) { Mousectl *mc; - threadfdwaitsetup(); mc = mallocz(sizeof(Mousectl), 1); if(i) mc->display = i->display; mc->c = chancreate(sizeof(Mouse), 0); + chansetname(mc->c, "mousec"); mc->resizec = chancreate(sizeof(int), 2); - threadcreate(_ioproc, mc, 32768); + chansetname(mc->resizec, "resizec"); + proccreate(_ioproc, mc, 32768); return mc; } |