--- rxvt-unicode/src/rxvttoolkit.h 2007/11/11 04:08:00 1.34 +++ rxvt-unicode/src/rxvttoolkit.h 2007/12/26 14:22:30 1.40 @@ -31,7 +31,6 @@ #include "ev_cpp.h" -#include "rxvtlib.h" #include "rxvtutil.h" #include "callback.h" @@ -103,7 +102,8 @@ struct xevent_watcher; template -struct event_vec : vector { +struct event_vec : vector +{ void erase_unordered (unsigned int pos) { watcher *w = (*this)[this->size () - 1]; @@ -115,7 +115,8 @@ } }; -struct rxvt_watcher { +struct rxvt_watcher +{ int active; /* 0 == inactive, else index into respective vector */ bool is_active () { return active; } @@ -123,7 +124,8 @@ rxvt_watcher () : active (0) { } }; -struct refcounted { +struct refcounted +{ int referenced; char *id; @@ -134,7 +136,8 @@ }; template -struct refcache : vector { +struct refcache : vector +{ T *get (const char *id); void put (T *obj); void clear (); @@ -149,7 +152,8 @@ struct rxvt_screen; -struct rxvt_drawable { +struct rxvt_drawable +{ rxvt_screen *screen; Drawable drawable; operator Drawable() { return drawable; } @@ -175,7 +179,8 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef USE_XIM -struct rxvt_xim : refcounted { +struct rxvt_xim : refcounted +{ void destroy (); rxvt_display *display; @@ -188,7 +193,8 @@ }; #endif -struct rxvt_screen { +struct rxvt_screen +{ rxvt_display *display; Display *dpy; int depth; @@ -210,10 +216,12 @@ void clear (); }; -struct rxvt_display : refcounted { +struct rxvt_display : refcounted +{ event_vec xw; - ev::io x_ev; void x_cb (ev::io &w, int revents); + ev::prepare flush_ev; void flush_cb (ev::prepare &w, int revents); + ev::io x_ev ; void x_cb (ev::io &w, int revents); #ifdef USE_XIM refcache xims; @@ -240,7 +248,11 @@ void ref_next (); ~rxvt_display (); - void flush (); + void flush () + { + flush_ev.start (); + } + Atom atom (const char *name); void set_selection_owner (rxvt_term *owner); @@ -258,11 +270,6 @@ #ifdef USE_XIM struct im_watcher : rxvt_watcher, callback { - template - im_watcher (O object, M method) - : callback (object, method) - { } - void start (rxvt_display *display) { display->reg (this); @@ -275,14 +282,10 @@ }; #endif -struct xevent_watcher : rxvt_watcher, callback { +struct xevent_watcher : rxvt_watcher, callback +{ Window window; - template - xevent_watcher (O object, M method) - : callback (object, method) - { } - void start (rxvt_display *display, Window window) { this->window = window; @@ -301,7 +304,8 @@ typedef unsigned long Pixel; -struct rgba { +struct rgba +{ unsigned short r, g, b, a; enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; @@ -314,7 +318,8 @@ { } }; -struct rxvt_color { +struct rxvt_color +{ #if XFT XftColor c; #else @@ -338,5 +343,13 @@ void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0)); }; +#if TRACE_PIXMAPS +Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d); +void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p); + +# define XCreatePixmap(dpy,r,w,h,d) trace_XCreatePixmap (__FILE__,__LINE__,dpy,r,w,h,d) +# define XFreePixmap(dpy,p) trace_XFreePixmap (__FILE__,__LINE__,dpy,p) +#endif + #endif