ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvttoolkit.h
(Generate patch)

Comparing rxvt-unicode/src/rxvttoolkit.h (file contents):
Revision 1.30 by sasha, Fri Jun 8 20:04:12 2007 UTC vs.
Revision 1.35 by sasha, Wed Nov 14 22:25:42 2007 UTC

27 27
28#if XFT 28#if XFT
29# include <X11/Xft/Xft.h> 29# include <X11/Xft/Xft.h>
30#endif 30#endif
31 31
32#include "iom.h" 32#include "ev_cpp.h"
33 33
34#include "rxvtlib.h" 34#include "rxvtlib.h"
35#include "rxvtutil.h" 35#include "rxvtutil.h"
36 36
37#include "callback.h" 37#include "callback.h"
65#endif 65#endif
66#if USE_XIM 66#if USE_XIM
67 XA_WM_LOCALE_NAME, 67 XA_WM_LOCALE_NAME,
68 XA_XIM_SERVERS, 68 XA_XIM_SERVERS,
69#endif 69#endif
70#if TRANSPARENT 70#if ENABLE_TRANSPARENCY
71 XA_XROOTPMAP_ID, 71 XA_XROOTPMAP_ID,
72 XA_ESETROOT_PMAP_ID, 72 XA_ESETROOT_PMAP_ID,
73#endif 73#endif
74#if ENABLE_XEMBED 74#if ENABLE_XEMBED
75 XA_XEMBED, 75 XA_XEMBED,
100struct rxvt_display; 100struct rxvt_display;
101 101
102struct im_watcher; 102struct im_watcher;
103struct xevent_watcher; 103struct xevent_watcher;
104 104
105template<class watcher>
106struct event_vec : vector<watcher *> {
107 void erase_unordered (unsigned int pos)
108 {
109 watcher *w = (*this)[this->size () - 1];
110 this->pop_back ();
111
112 if (!this->empty ())
113 if (((*this)[pos] = w)) // '=' is correct!
114 w->active = pos + 1;
115 }
116};
117
118struct rxvt_watcher {
119 int active; /* 0 == inactive, else index into respective vector */
120
121 bool is_active () { return active; }
122
123 rxvt_watcher () : active (0) { }
124};
125
105struct refcounted { 126struct refcounted {
106 int referenced; 127 int referenced;
107 char *id; 128 char *id;
108 129
109 refcounted (const char *id); 130 refcounted (const char *id);
187 void set (rxvt_display *disp); 208 void set (rxvt_display *disp);
188 void select_visual (int bitdepth); 209 void select_visual (int bitdepth);
189 void clear (); 210 void clear ();
190}; 211};
191 212
192#ifdef HAVE_AFTERIMAGE
193struct ASVisual;
194#endif
195
196struct rxvt_display : refcounted { 213struct rxvt_display : refcounted {
197 io_manager_vec<xevent_watcher> xw; 214 event_vec<xevent_watcher> xw;
198 215
199 io_watcher x_ev; void x_cb (io_watcher &w, short revents); 216 ev::io x_ev; void x_cb (ev::io &w, int revents);
200 217
201#ifdef USE_XIM 218#ifdef USE_XIM
202 refcache<rxvt_xim> xims; 219 refcache<rxvt_xim> xims;
203 vector<im_watcher *> imw; 220 vector<im_watcher *> imw;
204 221
208 225
209//public 226//public
210 Display *dpy; 227 Display *dpy;
211 int screen; 228 int screen;
212 Window root; 229 Window root;
213#ifdef HAVE_AFTERIMAGE
214 struct ASVisual *asv;
215#endif
216 rxvt_term *selection_owner; 230 rxvt_term *selection_owner;
217 Atom xa[NUM_XA]; 231 Atom xa[NUM_XA];
218 bool is_local; 232 bool is_local;
219#ifdef POINTER_BLANK 233#ifdef POINTER_BLANK
220 Cursor blank_cursor; 234 Cursor blank_cursor;
241 void put_xim (rxvt_xim *xim); 255 void put_xim (rxvt_xim *xim);
242#endif 256#endif
243}; 257};
244 258
245#ifdef USE_XIM 259#ifdef USE_XIM
246struct im_watcher : watcher, callback<void (void)> { 260struct im_watcher : rxvt_watcher, callback<void (void)> {
247 template<class O, class M> 261 template<class O, class M>
248 im_watcher (O object, M method) 262 im_watcher (O object, M method)
249 : callback<void (void)> (object, method) 263 : callback<void (void)> (object, method)
250 { } 264 { }
251 265
252 void start (rxvt_display *display) 266 void start (rxvt_display *display)
253 { 267 {
254 display->reg (this); 268 display->reg (this);
255 } 269 }
270
256 void stop (rxvt_display *display) 271 void stop (rxvt_display *display)
257 { 272 {
258 display->unreg (this); 273 display->unreg (this);
259 } 274 }
260}; 275};
261#endif 276#endif
262 277
263struct xevent_watcher : watcher, callback<void (XEvent &)> { 278struct xevent_watcher : rxvt_watcher, callback<void (XEvent &)> {
264 Window window; 279 Window window;
265 280
266 template<class O, class M> 281 template<class O, class M>
267 xevent_watcher (O object, M method) 282 xevent_watcher (O object, M method)
268 : callback<void (XEvent &)> (object, method) 283 : callback<void (XEvent &)> (object, method)
271 void start (rxvt_display *display, Window window) 286 void start (rxvt_display *display, Window window)
272 { 287 {
273 this->window = window; 288 this->window = window;
274 display->reg (this); 289 display->reg (this);
275 } 290 }
291
276 void stop (rxvt_display *display) 292 void stop (rxvt_display *display)
277 { 293 {
278 display->unreg (this); 294 display->unreg (this);
279 } 295 }
280}; 296};
313 bool alloc (rxvt_screen *screen, const rgba &color); 329 bool alloc (rxvt_screen *screen, const rgba &color);
314 void free (rxvt_screen *screen); 330 void free (rxvt_screen *screen);
315 331
316 void get (rgba &color); 332 void get (rgba &color);
317 void get (XColor &color); 333 void get (XColor &color);
318 334
319 bool set (rxvt_screen *screen, const char *name); 335 bool set (rxvt_screen *screen, const char *name);
320 bool set (rxvt_screen *screen, const rgba &color); 336 bool set (rxvt_screen *screen, const rgba &color);
321 337
322 void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0)); 338 void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0));
323}; 339};
324 340
325#endif 341#if TRACE_PIXMAPS
342Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d);
343void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p);
326 344
345# define XCreatePixmap(dpy,r,w,h,d) trace_XCreatePixmap (__FILE__,__LINE__,dpy,r,w,h,d)
346# define XFreePixmap(dpy,p) trace_XFreePixmap (__FILE__,__LINE__,dpy,p)
347#endif
348
349#endif
350

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines