2 * rxvttoolkit.h - provide toolkit-functionality for rxvt.
10 # include <X11/Xft/Xft.h>
24 struct xevent_watcher;
30 refcounted (const char *id);
31 bool init () { return false; }
36 struct refcache : vector<T *> {
37 T *get (const char *id);
47 /////////////////////////////////////////////////////////////////////////////
50 struct rxvt_xim : refcounted {
52 rxvt_display *display;
57 rxvt_xim (const char *id) : refcounted (id) { }
63 struct rxvt_display : refcounted {
66 io_manager_vec<xevent_watcher> xw;
68 io_watcher x_ev; void x_cb (io_watcher &w, short revents);
71 refcache<rxvt_xim> xims;
72 vector<im_watcher *> imw;
75 void im_change_check ();
85 rxvt_term *selection_owner;
86 #ifndef NO_SLOW_LINK_SUPPORT
93 rxvt_display (const char *id);
97 operator Display *() const { return display; }
100 Atom atom (const char *name);
101 void set_selection_owner (rxvt_term *owner);
103 void reg (xevent_watcher *w);
104 void unreg (xevent_watcher *w);
107 void reg (im_watcher *w);
108 void unreg (im_watcher *w);
110 rxvt_xim *get_xim (const char *locale, const char *modifiers);
111 void put_xim (rxvt_xim *xim);
116 struct im_watcher : watcher, callback0<void> {
117 template<class O1, class O2>
118 im_watcher (O1 *object, void (O2::*method) ())
119 : callback0<void> (object,method)
122 void start (rxvt_display *display)
126 void stop (rxvt_display *display)
128 display->unreg (this);
133 struct xevent_watcher : watcher, callback1<void, XEvent &> {
136 template<class O1, class O2>
137 xevent_watcher (O1 *object, void (O2::*method) (XEvent &))
138 : callback1<void, XEvent &> (object,method)
141 void start (rxvt_display *display, Window window)
143 this->window = window;
146 void stop (rxvt_display *display)
148 display->unreg (this);
152 extern refcache<rxvt_display> displays;
154 /////////////////////////////////////////////////////////////////////////////
156 typedef unsigned long Pixel;
161 operator Pixel () const { return c.pixel; }
164 operator Pixel () const { return p; }
167 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); }
168 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); }
170 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb);
172 bool set (rxvt_display *display, Pixel p);
173 bool set (rxvt_display *display, const char *name);
174 bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb);
176 rxvt_color fade (rxvt_display *, int percent);
178 void free (rxvt_display *display);