… | |
… | |
15 | #include "rxvtlib.h" |
15 | #include "rxvtlib.h" |
16 | #include "rxvtutil.h" |
16 | #include "rxvtutil.h" |
17 | |
17 | |
18 | #include "callback.h" |
18 | #include "callback.h" |
19 | |
19 | |
|
|
20 | // see rxvttoolkit.C:xa_names, which must be kept in sync |
|
|
21 | enum { |
|
|
22 | XA_TEXT, |
|
|
23 | XA_COMPOUND_TEXT, |
|
|
24 | XA_UTF8_STRING, |
|
|
25 | XA_MULTIPLE, |
|
|
26 | XA_TARGETS, |
|
|
27 | XA_TIMESTAMP, |
|
|
28 | XA_VT_SELECTION, |
|
|
29 | XA_INCR, |
|
|
30 | XA_WM_PROTOCOLS, |
|
|
31 | XA_WM_DELETE_WINDOW, |
|
|
32 | XA_CLIPBOARD, |
|
|
33 | #if ENABLE_FRILLS |
|
|
34 | XA_MOTIF_WM_HINTS, |
|
|
35 | #endif |
|
|
36 | #if ENABLE_EWMH |
|
|
37 | XA_NET_WM_PID, |
|
|
38 | XA_NET_WM_NAME, |
|
|
39 | XA_NET_WM_ICON_NAME, |
|
|
40 | XA_NET_WM_PING, |
|
|
41 | #endif |
|
|
42 | #if USE_XIM |
|
|
43 | XA_WM_LOCALE_NAME, |
|
|
44 | XA_XIM_SERVERS, |
|
|
45 | #endif |
|
|
46 | #if TRANSPARENT |
|
|
47 | XA_XROOTPMAP_ID, |
|
|
48 | XA_ESETROOT_PMAP_ID, |
|
|
49 | #endif |
|
|
50 | #if ENABLE_XEMBED |
|
|
51 | XA_XEMBED, |
|
|
52 | XA_XEMBED_INFO, |
|
|
53 | #endif |
|
|
54 | NUM_XA |
|
|
55 | }; |
|
|
56 | |
20 | struct rxvt_term; |
57 | struct rxvt_term; |
21 | struct rxvt_display; |
58 | struct rxvt_display; |
22 | |
59 | |
23 | struct im_watcher; |
60 | struct im_watcher; |
24 | struct xevent_watcher; |
61 | struct xevent_watcher; |
… | |
… | |
59 | bool ref_init (); |
96 | bool ref_init (); |
60 | ~rxvt_xim (); |
97 | ~rxvt_xim (); |
61 | }; |
98 | }; |
62 | #endif |
99 | #endif |
63 | |
100 | |
|
|
101 | struct rxvt_screen { |
|
|
102 | rxvt_display *display; |
|
|
103 | Display *xdisp; |
|
|
104 | int depth; |
|
|
105 | Visual *visual; |
|
|
106 | Colormap cmap; |
|
|
107 | |
|
|
108 | void set (rxvt_display *disp); |
|
|
109 | void set (rxvt_display *disp, int bitdepth); |
|
|
110 | void clear (); |
|
|
111 | }; |
|
|
112 | |
64 | struct rxvt_display : refcounted { |
113 | struct rxvt_display : refcounted { |
65 | Atom xa_xim_servers; |
|
|
66 | |
|
|
67 | io_manager_vec<xevent_watcher> xw; |
114 | io_manager_vec<xevent_watcher> xw; |
68 | |
115 | |
69 | io_watcher x_ev; void x_cb (io_watcher &w, short revents); |
116 | io_watcher x_ev; void x_cb (io_watcher &w, short revents); |
70 | |
117 | |
71 | #ifdef USE_XIM |
118 | #ifdef USE_XIM |
… | |
… | |
76 | void im_change_check (); |
123 | void im_change_check (); |
77 | #endif |
124 | #endif |
78 | |
125 | |
79 | //public |
126 | //public |
80 | Display *display; |
127 | Display *display; |
81 | int depth; |
|
|
82 | int screen; |
128 | int screen; |
83 | Visual *visual; |
|
|
84 | Colormap cmap; |
|
|
85 | Window root; |
129 | Window root; |
86 | rxvt_term *selection_owner; |
130 | rxvt_term *selection_owner; |
|
|
131 | Atom xa[NUM_XA]; |
87 | #ifndef NO_SLOW_LINK_SUPPORT |
132 | #ifndef NO_SLOW_LINK_SUPPORT |
88 | bool is_local; |
133 | bool is_local; |
89 | #endif |
134 | #endif |
90 | #ifdef POINTER_BLANK |
135 | #ifdef POINTER_BLANK |
91 | Cursor blank_cursor; |
136 | Cursor blank_cursor; |
… | |
… | |
95 | XrmDatabase get_resources (); |
140 | XrmDatabase get_resources (); |
96 | bool ref_init (); |
141 | bool ref_init (); |
97 | void ref_next (); |
142 | void ref_next (); |
98 | ~rxvt_display (); |
143 | ~rxvt_display (); |
99 | |
144 | |
100 | operator Display *() const { return display; } |
|
|
101 | |
|
|
102 | void flush (); |
145 | void flush (); |
103 | Atom atom (const char *name); |
146 | Atom atom (const char *name); |
104 | void set_selection_owner (rxvt_term *owner); |
147 | void set_selection_owner (rxvt_term *owner); |
105 | |
148 | |
106 | void reg (xevent_watcher *w); |
149 | void reg (xevent_watcher *w); |
… | |
… | |
155 | extern refcache<rxvt_display> displays; |
198 | extern refcache<rxvt_display> displays; |
156 | |
199 | |
157 | ///////////////////////////////////////////////////////////////////////////// |
200 | ///////////////////////////////////////////////////////////////////////////// |
158 | |
201 | |
159 | typedef unsigned long Pixel; |
202 | typedef unsigned long Pixel; |
|
|
203 | |
|
|
204 | struct rxvt_rgba { |
|
|
205 | unsigned short r, g, b, a; |
|
|
206 | |
|
|
207 | enum { MIN_CC = 0x0000, MAX_CC = 0xffff }; |
|
|
208 | |
|
|
209 | rxvt_rgba () |
|
|
210 | { } |
|
|
211 | |
|
|
212 | rxvt_rgba (unsigned short r, unsigned short g, unsigned short b, unsigned short a = MAX_CC) |
|
|
213 | : r(r), g(g), b(b), a(a) |
|
|
214 | { } |
|
|
215 | }; |
160 | |
216 | |
161 | struct rxvt_color { |
217 | struct rxvt_color { |
162 | #if XFT |
218 | #if XFT |
163 | XftColor c; |
219 | XftColor c; |
164 | operator Pixel () const { return c.pixel; } |
220 | operator Pixel () const { return c.pixel; } |
… | |
… | |
168 | #endif |
224 | #endif |
169 | |
225 | |
170 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
226 | bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } |
171 | 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); } |
172 | |
228 | |
173 | void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); |
229 | void get (rxvt_screen *screen, rxvt_rgba &rgba); |
174 | |
230 | |
175 | bool set (rxvt_display *display, Pixel p); |
|
|
176 | bool set (rxvt_display *display, const char *name); |
231 | bool set (rxvt_screen *screen, const char *name); |
177 | bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); |
232 | bool set (rxvt_screen *screen, rxvt_rgba rgba); |
178 | |
233 | |
179 | rxvt_color fade (rxvt_display *, int percent); // fades to black |
234 | rxvt_color fade (rxvt_screen *screen, int percent); // fades to black |
180 | rxvt_color fade (rxvt_display *, int percent, rxvt_color &fadeto); |
235 | rxvt_color fade (rxvt_screen *screen, int percent, rxvt_color &fadeto); |
181 | |
236 | |
182 | void free (rxvt_display *display); |
237 | void free (rxvt_screen *screen); |
183 | }; |
238 | }; |
184 | |
239 | |
185 | #endif |
240 | #endif |
186 | |
241 | |