… | |
… | |
28 | XA_VT_SELECTION, |
28 | XA_VT_SELECTION, |
29 | XA_INCR, |
29 | XA_INCR, |
30 | XA_WM_PROTOCOLS, |
30 | XA_WM_PROTOCOLS, |
31 | XA_WM_DELETE_WINDOW, |
31 | XA_WM_DELETE_WINDOW, |
32 | XA_CLIPBOARD, |
32 | XA_CLIPBOARD, |
|
|
33 | XA_AVERAGE_WIDTH, |
|
|
34 | XA_WEIGHT_NAME, |
|
|
35 | XA_SLANT, |
|
|
36 | XA_CHARSET_REGISTRY, |
|
|
37 | XA_CHARSET_ENCODING, |
33 | #if ENABLE_FRILLS |
38 | #if ENABLE_FRILLS |
34 | XA_MOTIF_WM_HINTS, |
39 | XA_MOTIF_WM_HINTS, |
35 | #endif |
40 | #endif |
36 | #if ENABLE_EWMH |
41 | #if ENABLE_EWMH |
37 | XA_NET_WM_PID, |
42 | XA_NET_WM_PID, |
… | |
… | |
49 | #endif |
54 | #endif |
50 | #if ENABLE_XEMBED |
55 | #if ENABLE_XEMBED |
51 | XA_XEMBED, |
56 | XA_XEMBED, |
52 | XA_XEMBED_INFO, |
57 | XA_XEMBED_INFO, |
53 | #endif |
58 | #endif |
|
|
59 | #if !ENABLE_MINIMAL |
|
|
60 | // these are usually allocated by other subsystens, but we do it |
|
|
61 | // here to avoid a server roundtrip. |
|
|
62 | XA_SCREEN_RESOURCES, |
|
|
63 | XA_XDCCC_LINEAR_RGB_CORRECTION, |
|
|
64 | XA_XDCCC_LINEAR_RGB_MATRICES, |
|
|
65 | XA_WM_COLORMAP_WINDOWS, |
|
|
66 | XA_WM_STATE, |
|
|
67 | XA_cursor, |
|
|
68 | # if USE_XIM |
|
|
69 | // various selection targets used by XIM |
|
|
70 | XA_TRANSPORT, |
|
|
71 | XA_LOCALES, |
|
|
72 | XA__XIM_PROTOCOL, |
|
|
73 | XA__XIM_XCONNECT, |
|
|
74 | XA__XIM_MOREDATA, |
|
|
75 | # endif |
|
|
76 | #endif |
54 | NUM_XA |
77 | NUM_XA |
55 | }; |
78 | }; |
56 | |
79 | |
57 | struct rxvt_term; |
80 | struct rxvt_term; |
58 | struct rxvt_display; |
81 | struct rxvt_display; |
… | |
… | |
82 | } |
105 | } |
83 | }; |
106 | }; |
84 | |
107 | |
85 | ///////////////////////////////////////////////////////////////////////////// |
108 | ///////////////////////////////////////////////////////////////////////////// |
86 | |
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 | |
87 | #ifdef USE_XIM |
137 | #ifdef USE_XIM |
88 | struct rxvt_xim : refcounted { |
138 | struct rxvt_xim : refcounted { |
89 | void destroy (); |
139 | void destroy (); |
90 | rxvt_display *display; |
140 | rxvt_display *display; |
91 | |
141 | |
… | |
… | |
98 | }; |
148 | }; |
99 | #endif |
149 | #endif |
100 | |
150 | |
101 | struct rxvt_screen { |
151 | struct rxvt_screen { |
102 | rxvt_display *display; |
152 | rxvt_display *display; |
103 | Display *xdisp; |
153 | Display *dpy; |
104 | int depth; |
154 | int depth; |
105 | Visual *visual; |
155 | Visual *visual; |
106 | Colormap cmap; |
156 | Colormap cmap; |
107 | |
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 | |
108 | void set (rxvt_display *disp); |
168 | void set (rxvt_display *disp); |
109 | void set (rxvt_display *disp, int bitdepth); |
169 | void set (rxvt_display *disp, int bitdepth); |
110 | void clear (); |
170 | void clear (); |
111 | }; |
171 | }; |
112 | |
172 | |
… | |
… | |
122 | void im_change_cb (); |
182 | void im_change_cb (); |
123 | void im_change_check (); |
183 | void im_change_check (); |
124 | #endif |
184 | #endif |
125 | |
185 | |
126 | //public |
186 | //public |
127 | Display *display; |
187 | Display *dpy; |
128 | int screen; |
188 | int screen; |
129 | Window root; |
189 | Window root; |
130 | rxvt_term *selection_owner; |
190 | rxvt_term *selection_owner; |
131 | Atom xa[NUM_XA]; |
191 | Atom xa[NUM_XA]; |
132 | #ifndef NO_SLOW_LINK_SUPPORT |
192 | #ifndef NO_SLOW_LINK_SUPPORT |
… | |
… | |
135 | #ifdef POINTER_BLANK |
195 | #ifdef POINTER_BLANK |
136 | Cursor blank_cursor; |
196 | Cursor blank_cursor; |
137 | #endif |
197 | #endif |
138 | |
198 | |
139 | rxvt_display (const char *id); |
199 | rxvt_display (const char *id); |
140 | XrmDatabase get_resources (); |
200 | XrmDatabase get_resources (bool refresh); |
141 | bool ref_init (); |
201 | bool ref_init (); |
142 | void ref_next (); |
202 | void ref_next (); |
143 | ~rxvt_display (); |
203 | ~rxvt_display (); |
144 | |
204 | |
145 | void flush (); |
205 | void flush (); |
… | |
… | |
199 | |
259 | |
200 | ///////////////////////////////////////////////////////////////////////////// |
260 | ///////////////////////////////////////////////////////////////////////////// |
201 | |
261 | |
202 | typedef unsigned long Pixel; |
262 | typedef unsigned long Pixel; |
203 | |
263 | |
204 | struct rxvt_rgba { |
264 | struct rgba { |
205 | unsigned short r, g, b, a; |
265 | unsigned short r, g, b, a; |
206 | |
266 | |
207 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
267 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
208 | |
268 | |
209 | rxvt_rgba () |
269 | rgba () |
210 | { } |
270 | { } |
211 | |
271 | |
212 | 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) |
213 | : r(r), g(g), b(b), a(a) |
273 | : r(r), g(g), b(b), a(a) |
214 | { } |
274 | { } |
215 | }; |
275 | }; |
216 | |
276 | |
217 | struct rxvt_color { |
277 | struct rxvt_color { |
218 | #if XFT |
278 | #if XFT |
219 | XftColor c; |
279 | XftColor c; |
|
|
280 | #else |
|
|
281 | XColor c; |
|
|
282 | #endif |
|
|
283 | |
220 | operator Pixel () const { return c.pixel; } |
284 | operator Pixel () const { return c.pixel; } |
221 | #else |
|
|
222 | Pixel p; |
|
|
223 | operator Pixel () const { return p; } |
|
|
224 | #endif |
|
|
225 | |
285 | |
226 | 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); } |
227 | 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); } |
228 | |
288 | |
229 | 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); |
230 | |
294 | |
231 | bool set (rxvt_screen *screen, const char *name); |
295 | bool set (rxvt_screen *screen, const char *name); |
232 | bool set (rxvt_screen *screen, rxvt_rgba rgba); |
296 | bool set (rxvt_screen *screen, const rgba &color); |
233 | |
297 | |
234 | 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)); |
235 | rxvt_color fade (rxvt_screen *screen, int percent, rxvt_color &fadeto); |
|
|
236 | |
|
|
237 | void free (rxvt_screen *screen); |
|
|
238 | }; |
299 | }; |
239 | |
300 | |
240 | #endif |
301 | #endif |
241 | |
302 | |