2 * rxvttoolkit.h - provide toolkit-functionality for rxvt.
10 # include <X11/Xft/Xft.h>
20 // see rxvttoolkit.C:xa_names, which must be kept in sync
61 struct xevent_watcher;
67 refcounted (const char *id);
68 bool ref_init () { return false; }
74 struct refcache : vector<T *> {
75 T *get (const char *id);
85 /////////////////////////////////////////////////////////////////////////////
88 struct rxvt_xim : refcounted {
90 rxvt_display *display;
95 rxvt_xim (const char *id) : refcounted (id) { }
102 rxvt_display *display;
108 void set (rxvt_display *disp);
109 void set (rxvt_display *disp, int depth);
113 struct rxvt_display : refcounted {
114 io_manager_vec<xevent_watcher> xw;
116 io_watcher x_ev; void x_cb (io_watcher &w, short revents);
119 refcache<rxvt_xim> xims;
120 vector<im_watcher *> imw;
122 void im_change_cb ();
123 void im_change_check ();
130 rxvt_term *selection_owner;
132 #ifndef NO_SLOW_LINK_SUPPORT
139 rxvt_display (const char *id);
140 XrmDatabase get_resources ();
146 Atom atom (const char *name);
147 void set_selection_owner (rxvt_term *owner);
149 void reg (xevent_watcher *w);
150 void unreg (xevent_watcher *w);
153 void reg (im_watcher *w);
154 void unreg (im_watcher *w);
156 rxvt_xim *get_xim (const char *locale, const char *modifiers);
157 void put_xim (rxvt_xim *xim);
162 struct im_watcher : watcher, callback0<void> {
163 template<class O1, class O2>
164 im_watcher (O1 *object, void (O2::*method) ())
165 : callback0<void> (object,method)
168 void start (rxvt_display *display)
172 void stop (rxvt_display *display)
174 display->unreg (this);
179 struct xevent_watcher : watcher, callback1<void, XEvent &> {
182 template<class O1, class O2>
183 xevent_watcher (O1 *object, void (O2::*method) (XEvent &))
184 : callback1<void, XEvent &> (object,method)
187 void start (rxvt_display *display, Window window)
189 this->window = window;
192 void stop (rxvt_display *display)
194 display->unreg (this);
198 extern refcache<rxvt_display> displays;
200 /////////////////////////////////////////////////////////////////////////////
202 typedef unsigned long Pixel;
207 operator Pixel () const { return c.pixel; }
210 operator Pixel () const { return p; }
213 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); }
214 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); }
216 void get (rxvt_screen *screen, unsigned short &cr, unsigned short &cg, unsigned short &cb);
218 bool set (rxvt_screen *screen, Pixel p);
219 bool set (rxvt_screen *screen, const char *name);
220 bool set (rxvt_screen *screen, unsigned short cr, unsigned short cg, unsigned short cb);
222 rxvt_color fade (rxvt_screen *screen, int percent); // fades to black
223 rxvt_color fade (rxvt_screen *screen, int percent, rxvt_color &fadeto);
225 void free (rxvt_screen *screen);