Re: [dwm] XCB?

From: Donald Chai <donald.chai_AT_gmail.com>
Date: Sun, 14 Sep 2008 08:28:24 -0700

On Sep 14, 2008, at 3:02 AM, Johannes Wegener wrote:

> I recently read that awesome is going to use XCB over Xlib and says
> that
> it is faster becouse it is asynchronous.
> Does XCB realy its job faster than Xlib?
> And if this is the case is dwm going to use XCB in any further
> release?

IMHO, asynchonicity probably only matters if you're using a bloated
app over a slow (network) connection. Since you're probably running
your window manager on your local machine, I'm not sure this will
help dwm.

What would make dwm fast is really to minimize the number of Map and
Expose events, so e.g. you don't render a Firefox window if it's
unnecessary (cf. changeset 1355).

Some people mentioned that mouseresize is really slow in dwm. The
following patch removes resize requests that have not been handled
before making a new one. For the benchmark of "hold down mouse button
and move pointer wildly", it does great. I'm sure it probably breaks
something else though...

diff -r 895c19c3a005 dwm.c
--- a/dwm.c Thu Sep 11 18:53:26 2008 -0700
+++ b/dwm.c Sun Sep 14 08:24:24 2008 -0700
@@ -1109,7 +1109,7 @@
         int ocx, ocy;
         int nw, nh;
         Client *c;
- XEvent ev;
+ XEvent ev, tmp;

         if(!(c = sel))
                 return;
@@ -1129,6 +1129,13 @@
                         handler[ev.type](&ev);
                         break;
                 case MotionNotify:
+ // remove resize events belonging to this
window: it doesn't
+ // need to process them.
+ // I should probably leave the mouse event in
the
+ // event queue...
+ while(XCheckMaskEvent(dpy, MOUSEMASK, &tmp));
+ while(XCheckWindowEvent(dpy, root,
PropertyChangeMask|StructureNotifyMask, &tmp));
+ while(XCheckWindowEvent(dpy, c->win,
PropertyChangeMask|StructureNotifyMask, &tmp));
                         XSync(dpy, False);
                         nw = MAX(ev.xmotion.x - NOBORDER(ocx) + 1, 1);
                         nh = MAX(ev.xmotion.y - NOBORDER(ocy) + 1, 1);
Received on Sun Sep 14 2008 - 15:28:24 UTC

This archive was generated by hypermail 2.2.0 : Sun Sep 14 2008 - 15:36:03 UTC