… | |
… | |
16 | #include "rxvtutil.h" |
16 | #include "rxvtutil.h" |
17 | |
17 | |
18 | #include "callback.h" |
18 | #include "callback.h" |
19 | |
19 | |
20 | struct rxvt_term; |
20 | struct rxvt_term; |
|
|
21 | struct rxvt_display; |
21 | |
22 | |
22 | struct im_watcher; |
23 | struct im_watcher; |
23 | struct xevent_watcher; |
24 | struct xevent_watcher; |
24 | |
25 | |
25 | struct refcounted { |
26 | struct refcounted { |
26 | int referenced; |
27 | int referenced; |
27 | char *id; |
28 | char *id; |
28 | |
29 | |
29 | refcounted (const char *id); |
30 | refcounted (const char *id); |
30 | bool init () { return false; } |
31 | bool ref_init () { return false; } |
|
|
32 | void ref_next () { } |
31 | ~refcounted (); |
33 | ~refcounted (); |
32 | }; |
34 | }; |
33 | |
35 | |
34 | template<class T> |
36 | template<class T> |
35 | struct refcache : vector<T *> { |
37 | struct refcache : vector<T *> { |
36 | T *get (const char *id); |
38 | T *get (const char *id); |
37 | void put (T *obj); |
39 | void put (T *obj); |
|
|
40 | void clear (); |
|
|
41 | |
38 | ~refcache (); |
42 | ~refcache () |
|
|
43 | { |
|
|
44 | clear (); |
|
|
45 | } |
39 | }; |
46 | }; |
40 | |
47 | |
41 | ///////////////////////////////////////////////////////////////////////////// |
48 | ///////////////////////////////////////////////////////////////////////////// |
42 | |
49 | |
43 | #ifdef USE_XIM |
50 | #ifdef USE_XIM |
… | |
… | |
47 | |
54 | |
48 | //public |
55 | //public |
49 | XIM xim; |
56 | XIM xim; |
50 | |
57 | |
51 | rxvt_xim (const char *id) : refcounted (id) { } |
58 | rxvt_xim (const char *id) : refcounted (id) { } |
52 | bool init (); |
59 | bool ref_init (); |
53 | ~rxvt_xim (); |
60 | ~rxvt_xim (); |
54 | }; |
61 | }; |
55 | #endif |
62 | #endif |
56 | |
63 | |
57 | struct rxvt_display : refcounted { |
64 | struct rxvt_display : refcounted { |
… | |
… | |
64 | #ifdef USE_XIM |
71 | #ifdef USE_XIM |
65 | refcache<rxvt_xim> xims; |
72 | refcache<rxvt_xim> xims; |
66 | vector<im_watcher *> imw; |
73 | vector<im_watcher *> imw; |
67 | |
74 | |
68 | void im_change_cb (); |
75 | void im_change_cb (); |
|
|
76 | void im_change_check (); |
69 | #endif |
77 | #endif |
70 | |
78 | |
71 | //public |
79 | //public |
72 | Display *display; |
80 | Display *display; |
73 | int depth; |
81 | int depth; |
74 | int screen; |
82 | int screen; |
75 | Visual *visual; |
83 | Visual *visual; |
76 | Colormap cmap; |
84 | Colormap cmap; |
77 | Window root; |
85 | Window root; |
78 | rxvt_term *selection_owner; |
86 | rxvt_term *selection_owner; |
79 | #ifndef NO_SLOW_LINK_SUPPORT |
87 | #ifndef NO_SLOW_LINK_SUPPORT |
80 | bool is_local; |
88 | bool is_local; |
|
|
89 | #endif |
|
|
90 | #ifdef POINTER_BLANK |
|
|
91 | Cursor blank_cursor; |
81 | #endif |
92 | #endif |
82 | |
93 | |
83 | rxvt_display (const char *id); |
94 | rxvt_display (const char *id); |
|
|
95 | XrmDatabase get_resources (); |
84 | bool init (); |
96 | bool ref_init (); |
|
|
97 | void ref_next (); |
85 | ~rxvt_display (); |
98 | ~rxvt_display (); |
86 | |
99 | |
|
|
100 | operator Display *() const { return display; } |
|
|
101 | |
87 | void flush (); |
102 | void flush (); |
88 | |
103 | Atom atom (const char *name); |
89 | void set_selection_owner (rxvt_term *owner); |
104 | void set_selection_owner (rxvt_term *owner); |
90 | |
105 | |
91 | void reg (xevent_watcher *w); |
106 | void reg (xevent_watcher *w); |
92 | void unreg (xevent_watcher *w); |
107 | void unreg (xevent_watcher *w); |
93 | |
108 | |
… | |
… | |
96 | void unreg (im_watcher *w); |
111 | void unreg (im_watcher *w); |
97 | |
112 | |
98 | rxvt_xim *get_xim (const char *locale, const char *modifiers); |
113 | rxvt_xim *get_xim (const char *locale, const char *modifiers); |
99 | void put_xim (rxvt_xim *xim); |
114 | void put_xim (rxvt_xim *xim); |
100 | #endif |
115 | #endif |
101 | |
|
|
102 | Atom atom (const char *name); |
|
|
103 | }; |
116 | }; |
104 | |
117 | |
105 | #ifdef USE_XIM |
118 | #ifdef USE_XIM |
106 | struct im_watcher : watcher, callback0<void> { |
119 | struct im_watcher : watcher, callback0<void> { |
107 | template<class O1, class O2> |
120 | template<class O1, class O2> |
… | |
… | |
161 | |
174 | |
162 | bool set (rxvt_display *display, Pixel p); |
175 | bool set (rxvt_display *display, Pixel p); |
163 | bool set (rxvt_display *display, const char *name); |
176 | bool set (rxvt_display *display, const char *name); |
164 | bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); |
177 | bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); |
165 | |
178 | |
166 | rxvt_color fade (rxvt_display *, int percent); |
179 | rxvt_color fade (rxvt_display *, int percent); // fades to black |
|
|
180 | rxvt_color fade (rxvt_display *, int percent, rxvt_color &fadeto); |
167 | |
181 | |
168 | void free (rxvt_display *display); |
182 | void free (rxvt_display *display); |
169 | }; |
183 | }; |
170 | |
184 | |
171 | #endif |
185 | #endif |