… | |
… | |
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; |
… | |
… | |
96 | bool ref_init (); |
119 | bool ref_init (); |
97 | ~rxvt_xim (); |
120 | ~rxvt_xim (); |
98 | }; |
121 | }; |
99 | #endif |
122 | #endif |
100 | |
123 | |
|
|
124 | struct rxvt_screen { |
|
|
125 | rxvt_display *display; |
|
|
126 | Display *xdisp; |
|
|
127 | int depth; |
|
|
128 | Visual *visual; |
|
|
129 | Colormap cmap; |
|
|
130 | |
|
|
131 | void set (rxvt_display *disp); |
|
|
132 | void set (rxvt_display *disp, int bitdepth); |
|
|
133 | void clear (); |
|
|
134 | }; |
|
|
135 | |
101 | struct rxvt_display : refcounted { |
136 | struct rxvt_display : refcounted { |
102 | io_manager_vec<xevent_watcher> xw; |
137 | io_manager_vec<xevent_watcher> xw; |
103 | |
138 | |
104 | io_watcher x_ev; void x_cb (io_watcher &w, short revents); |
139 | io_watcher x_ev; void x_cb (io_watcher &w, short revents); |
105 | |
140 | |
… | |
… | |
111 | void im_change_check (); |
146 | void im_change_check (); |
112 | #endif |
147 | #endif |
113 | |
148 | |
114 | //public |
149 | //public |
115 | Display *display; |
150 | Display *display; |
116 | int depth; |
|
|
117 | int screen; |
151 | int screen; |
118 | Visual *visual; |
|
|
119 | Colormap cmap; |
|
|
120 | Window root; |
152 | Window root; |
121 | rxvt_term *selection_owner; |
153 | rxvt_term *selection_owner; |
122 | Atom xa[NUM_XA]; |
154 | Atom xa[NUM_XA]; |
123 | #ifndef NO_SLOW_LINK_SUPPORT |
155 | #ifndef NO_SLOW_LINK_SUPPORT |
124 | bool is_local; |
156 | bool is_local; |
… | |
… | |
189 | extern refcache<rxvt_display> displays; |
221 | extern refcache<rxvt_display> displays; |
190 | |
222 | |
191 | ///////////////////////////////////////////////////////////////////////////// |
223 | ///////////////////////////////////////////////////////////////////////////// |
192 | |
224 | |
193 | typedef unsigned long Pixel; |
225 | typedef unsigned long Pixel; |
|
|
226 | |
|
|
227 | struct rxvt_rgba { |
|
|
228 | unsigned short r, g, b, a; |
|
|
229 | |
|
|
230 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
|
|
231 | |
|
|
232 | rxvt_rgba () |
|
|
233 | { } |
|
|
234 | |
|
|
235 | rxvt_rgba (unsigned short r, unsigned short g, unsigned short b, unsigned short a = MAX_CC) |
|
|
236 | : r(r), g(g), b(b), a(a) |
|
|
237 | { } |
|
|
238 | }; |
194 | |
239 | |
195 | struct rxvt_color { |
240 | struct rxvt_color { |
196 | #if XFT |
241 | #if XFT |
197 | XftColor c; |
242 | XftColor c; |
198 | operator Pixel () const { return c.pixel; } |
243 | operator Pixel () const { return c.pixel; } |
… | |
… | |
202 | #endif |
247 | #endif |
203 | |
248 | |
204 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
249 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
205 | 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); } |
206 | |
251 | |
207 | void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); |
252 | bool alloc (rxvt_screen *screen, const rxvt_rgba &color); |
|
|
253 | void free (rxvt_screen *screen); |
|
|
254 | |
|
|
255 | void get (rxvt_screen *screen, rxvt_rgba &color); |
208 | |
256 | |
209 | bool set (rxvt_display *display, Pixel p); |
|
|
210 | bool set (rxvt_display *display, const char *name); |
257 | bool set (rxvt_screen *screen, const char *name); |
211 | bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); |
258 | bool set (rxvt_screen *screen, const rxvt_rgba &color); |
212 | |
259 | |
213 | rxvt_color fade (rxvt_display *, int percent); // fades to black |
260 | void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rxvt_rgba &to = rxvt_rgba (0, 0, 0)); |
214 | rxvt_color fade (rxvt_display *, int percent, rxvt_color &fadeto); |
|
|
215 | |
|
|
216 | void free (rxvt_display *display); |
|
|
217 | }; |
261 | }; |
218 | |
262 | |
219 | #endif |
263 | #endif |
220 | |
264 | |