--- rxvt-unicode/src/rxvttoolkit.C 2007/11/11 04:08:00 1.75 +++ rxvt-unicode/src/rxvttoolkit.C 2007/12/07 01:29:00 1.80 @@ -297,15 +297,15 @@ rxvt_display::rxvt_display (const char *id) : refcounted (id) -, x_ev (this, &rxvt_display::x_cb) , selection_owner (0) { + x_ev.set (this); } XrmDatabase rxvt_display::get_resources (bool refresh) { - char *homedir = (char *)getenv ("HOME"); + char *homedir = getenv ("HOME"); char fname[1024]; /* @@ -320,7 +320,7 @@ // 6. System wide per application default file. /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */ - if ((xe = (char *)getenv ("XAPPLRESDIR"))) + if ((xe = getenv ("XAPPLRESDIR"))) { snprintf (fname, sizeof (fname), "%s/%s", xe, RESCLASS); @@ -402,7 +402,7 @@ // 3. User's per host defaults file /* Add in XENVIRONMENT file */ - if ((xe = (char *)getenv ("XENVIRONMENT")) + if ((xe = getenv ("XENVIRONMENT")) && (rdb1 = XrmGetFileDatabase (xe))) XrmMergeDatabases (rdb1, &database); else if (homedir) @@ -464,7 +464,7 @@ int fd = XConnectionNumber (dpy); // try to detect wether we have a local connection. - // assume unix domains socket == local, everything else not + // assume unix domain socket == local, everything else not // TODO: might want to check for inet/127.0.0.1 is_local = 0; sockaddr_un sa; @@ -542,7 +542,7 @@ void rxvt_display::x_cb (ev::io &w, int revents) { - do + while (XEventsQueued (dpy, QueuedAfterReading)) { XEvent xev; XNextEvent (dpy, &xev); @@ -569,17 +569,13 @@ } #endif } - while (XEventsQueued (dpy, QueuedAlready)); XFlush (dpy); } void rxvt_display::flush () { - if (XEventsQueued (dpy, QueuedAlready)) - x_cb (x_ev, ev::READ); - - XFlush (dpy); + x_cb (x_ev, ev::READ); } void rxvt_display::reg (xevent_watcher *w) @@ -888,3 +884,19 @@ ); } +#if TRACE_PIXMAPS +# undef XCreatePixmap +# undef XFreePixmap +Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d) +{ + Pixmap res = XCreatePixmap (dpy, r, w, h, d); + fprintf (stderr, "%s:%d: XCreatePixmap (%p,%lX,%u,%u,%u) returned %lX\n", file, line, dpy, r, w, h, d, res); + return res; +} + +void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p) +{ + fprintf (stderr, "%s:%d: XFreePixmap (%p,%lX)\n", file, line, dpy, p); + XFreePixmap (dpy,p); +} +#endif