… | |
… | |
105 | } |
105 | } |
106 | }; |
106 | }; |
107 | |
107 | |
108 | ///////////////////////////////////////////////////////////////////////////// |
108 | ///////////////////////////////////////////////////////////////////////////// |
109 | |
109 | |
|
|
110 | struct rxvt_screen; |
|
|
111 | |
|
|
112 | struct rxvt_drawable { |
|
|
113 | rxvt_screen *screen; |
|
|
114 | Drawable drawable; |
|
|
115 | operator Drawable() { return drawable; } |
|
|
116 | |
|
|
117 | #if XFT |
|
|
118 | XftDraw *xftdrawable; |
|
|
119 | operator XftDraw *(); |
|
|
120 | #endif |
|
|
121 | |
|
|
122 | rxvt_drawable (rxvt_screen *screen, Drawable drawable) |
|
|
123 | : screen(screen), |
|
|
124 | #if XFT |
|
|
125 | xftdrawable(0), |
|
|
126 | #endif |
|
|
127 | drawable(drawable) |
|
|
128 | { } |
|
|
129 | |
|
|
130 | #if XFT |
|
|
131 | ~rxvt_drawable (); |
|
|
132 | #endif |
|
|
133 | }; |
|
|
134 | |
|
|
135 | ///////////////////////////////////////////////////////////////////////////// |
|
|
136 | |
110 | #ifdef USE_XIM |
137 | #ifdef USE_XIM |
111 | struct rxvt_xim : refcounted { |
138 | struct rxvt_xim : refcounted { |
112 | void destroy (); |
139 | void destroy (); |
113 | rxvt_display *display; |
140 | rxvt_display *display; |
114 | |
141 | |
… | |
… | |
121 | }; |
148 | }; |
122 | #endif |
149 | #endif |
123 | |
150 | |
124 | struct rxvt_screen { |
151 | struct rxvt_screen { |
125 | rxvt_display *display; |
152 | rxvt_display *display; |
126 | Display *xdisp; |
153 | Display *dpy; |
127 | int depth; |
154 | int depth; |
128 | Visual *visual; |
155 | Visual *visual; |
129 | Colormap cmap; |
156 | Colormap cmap; |
130 | |
157 | |
|
|
158 | #if XFT |
|
|
159 | // scratch pixmap |
|
|
160 | rxvt_drawable *scratch_area; |
|
|
161 | int scratch_w, scratch_h; |
|
|
162 | |
|
|
163 | rxvt_drawable &scratch_drawable (int w, int h); |
|
|
164 | |
|
|
165 | rxvt_screen (); |
|
|
166 | #endif |
|
|
167 | |
131 | void set (rxvt_display *disp); |
168 | void set (rxvt_display *disp); |
132 | void set (rxvt_display *disp, int bitdepth); |
169 | void set (rxvt_display *disp, int bitdepth); |
133 | void clear (); |
170 | void clear (); |
134 | }; |
171 | }; |
135 | |
172 | |
… | |
… | |
145 | void im_change_cb (); |
182 | void im_change_cb (); |
146 | void im_change_check (); |
183 | void im_change_check (); |
147 | #endif |
184 | #endif |
148 | |
185 | |
149 | //public |
186 | //public |
150 | Display *display; |
187 | Display *dpy; |
151 | int screen; |
188 | int screen; |
152 | Window root; |
189 | Window root; |
153 | rxvt_term *selection_owner; |
190 | rxvt_term *selection_owner; |
154 | Atom xa[NUM_XA]; |
191 | Atom xa[NUM_XA]; |
155 | #ifndef NO_SLOW_LINK_SUPPORT |
192 | #ifndef NO_SLOW_LINK_SUPPORT |
… | |
… | |
158 | #ifdef POINTER_BLANK |
195 | #ifdef POINTER_BLANK |
159 | Cursor blank_cursor; |
196 | Cursor blank_cursor; |
160 | #endif |
197 | #endif |
161 | |
198 | |
162 | rxvt_display (const char *id); |
199 | rxvt_display (const char *id); |
163 | XrmDatabase get_resources (); |
200 | XrmDatabase get_resources (bool refresh); |
164 | bool ref_init (); |
201 | bool ref_init (); |
165 | void ref_next (); |
202 | void ref_next (); |
166 | ~rxvt_display (); |
203 | ~rxvt_display (); |
167 | |
204 | |
168 | void flush (); |
205 | void flush (); |
… | |
… | |
222 | |
259 | |
223 | ///////////////////////////////////////////////////////////////////////////// |
260 | ///////////////////////////////////////////////////////////////////////////// |
224 | |
261 | |
225 | typedef unsigned long Pixel; |
262 | typedef unsigned long Pixel; |
226 | |
263 | |
227 | struct rxvt_rgba { |
264 | struct rgba { |
228 | unsigned short r, g, b, a; |
265 | unsigned short r, g, b, a; |
229 | |
266 | |
230 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
267 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
231 | |
268 | |
232 | rxvt_rgba () |
269 | rgba () |
233 | { } |
270 | { } |
234 | |
271 | |
235 | rxvt_rgba (unsigned short r, unsigned short g, unsigned short b, unsigned short a = MAX_CC) |
272 | rgba (unsigned short r, unsigned short g, unsigned short b, unsigned short a = MAX_CC) |
236 | : r(r), g(g), b(b), a(a) |
273 | : r(r), g(g), b(b), a(a) |
237 | { } |
274 | { } |
238 | }; |
275 | }; |
239 | |
276 | |
240 | struct rxvt_color { |
277 | struct rxvt_color { |
241 | #if XFT |
278 | #if XFT |
242 | XftColor c; |
279 | XftColor c; |
|
|
280 | #else |
|
|
281 | XColor c; |
|
|
282 | #endif |
|
|
283 | |
243 | operator Pixel () const { return c.pixel; } |
284 | operator Pixel () const { return c.pixel; } |
244 | #else |
|
|
245 | Pixel p; |
|
|
246 | operator Pixel () const { return p; } |
|
|
247 | #endif |
|
|
248 | |
285 | |
249 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
286 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
250 | bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } |
287 | bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } |
251 | |
288 | |
252 | void get (rxvt_screen *screen, rxvt_rgba &rgba); |
289 | bool alloc (rxvt_screen *screen, const rgba &color); |
|
|
290 | void free (rxvt_screen *screen); |
|
|
291 | |
|
|
292 | void get (rgba &color); |
|
|
293 | void get (XColor &color); |
253 | |
294 | |
254 | bool alloc (rxvt_screen *screen, rxvt_rgba rgba); |
|
|
255 | |
|
|
256 | bool set (rxvt_screen *screen, const char *name); |
295 | bool set (rxvt_screen *screen, const char *name); |
257 | bool set (rxvt_screen *screen, rxvt_rgba rgba); |
296 | bool set (rxvt_screen *screen, const rgba &color); |
258 | |
297 | |
259 | rxvt_color fade (rxvt_screen *screen, int percent); // fades to black |
298 | void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0)); |
260 | rxvt_color fade (rxvt_screen *screen, int percent, rxvt_color &fadeto); |
|
|
261 | |
|
|
262 | void free (rxvt_screen *screen); |
|
|
263 | }; |
299 | }; |
264 | |
300 | |
265 | #endif |
301 | #endif |
266 | |
302 | |