… | |
… | |
11 | |
11 | |
12 | #include "rxvtlib.h" |
12 | #include "rxvtlib.h" |
13 | #include "rxvtstl.h" |
13 | #include "rxvtstl.h" |
14 | |
14 | |
15 | #include "callback.h" |
15 | #include "callback.h" |
|
|
16 | |
|
|
17 | extern class byteorder { |
|
|
18 | uint32_t e; |
|
|
19 | public: |
|
|
20 | byteorder (); |
|
|
21 | |
|
|
22 | bool big_endian () { return e == 0x11223344; }; |
|
|
23 | bool network () { return e == 0x11223344; }; |
|
|
24 | bool little_endian () { return e == 0x44332211; }; |
|
|
25 | bool vax () { return e == 0x44332211; }; |
|
|
26 | } byteorder; |
16 | |
27 | |
17 | struct rxvt_term; |
28 | struct rxvt_term; |
18 | |
29 | |
19 | struct im_watcher; |
30 | struct im_watcher; |
20 | struct xevent_watcher; |
31 | struct xevent_watcher; |
… | |
… | |
35 | ~refcache (); |
46 | ~refcache (); |
36 | }; |
47 | }; |
37 | |
48 | |
38 | ///////////////////////////////////////////////////////////////////////////// |
49 | ///////////////////////////////////////////////////////////////////////////// |
39 | |
50 | |
|
|
51 | #ifdef USE_XIM |
40 | struct rxvt_xim : refcounted { |
52 | struct rxvt_xim : refcounted { |
41 | void destroy (); |
53 | void destroy (); |
42 | rxvt_display *display; |
54 | rxvt_display *display; |
43 | |
55 | |
44 | //public |
56 | //public |
… | |
… | |
46 | |
58 | |
47 | rxvt_xim (const char *id) : refcounted (id) { } |
59 | rxvt_xim (const char *id) : refcounted (id) { } |
48 | bool init (); |
60 | bool init (); |
49 | ~rxvt_xim (); |
61 | ~rxvt_xim (); |
50 | }; |
62 | }; |
|
|
63 | #endif |
51 | |
64 | |
52 | struct rxvt_display : refcounted { |
65 | struct rxvt_display : refcounted { |
53 | Atom xa_xim_servers; |
66 | Atom xa_xim_servers; |
54 | |
67 | |
55 | rxvt_term *selection_owner; |
|
|
56 | |
|
|
57 | io_manager_vec<xevent_watcher> xw; |
68 | io_manager_vec<xevent_watcher> xw; |
58 | |
69 | |
59 | io_watcher x_ev; void x_cb (io_watcher &w, short revents); |
70 | io_watcher x_ev; void x_cb (io_watcher &w, short revents); |
60 | |
71 | |
|
|
72 | #ifdef USE_XIM |
61 | refcache<rxvt_xim> xims; |
73 | refcache<rxvt_xim> xims; |
62 | vector<im_watcher *> imw; |
74 | vector<im_watcher *> imw; |
63 | |
75 | |
64 | void im_change_cb (); |
76 | void im_change_cb (); |
|
|
77 | #endif |
65 | |
78 | |
66 | //public |
79 | //public |
67 | Display *display; |
80 | Display *display; |
68 | int depth; |
81 | int depth; |
69 | int screen; |
82 | int screen; |
70 | Visual *visual; |
83 | Visual *visual; |
71 | Colormap cmap; |
84 | Colormap cmap; |
72 | Window root; |
85 | Window root; |
|
|
86 | rxvt_term *selection_owner; |
|
|
87 | #ifndef NO_SLOW_LINK_SUPPORT |
|
|
88 | bool is_local; |
|
|
89 | #endif |
73 | |
90 | |
74 | rxvt_display (const char *id); |
91 | rxvt_display (const char *id); |
75 | bool init (); |
92 | bool init (); |
76 | ~rxvt_display (); |
93 | ~rxvt_display (); |
77 | |
94 | |
78 | void flush (); |
95 | void flush (); |
79 | |
96 | |
|
|
97 | void set_selection_owner (rxvt_term *owner); |
|
|
98 | |
80 | void reg (xevent_watcher *w); |
99 | void reg (xevent_watcher *w); |
81 | void unreg (xevent_watcher *w); |
100 | void unreg (xevent_watcher *w); |
|
|
101 | |
|
|
102 | #ifdef USE_XIM |
82 | void reg (im_watcher *w); |
103 | void reg (im_watcher *w); |
83 | void unreg (im_watcher *w); |
104 | void unreg (im_watcher *w); |
84 | |
105 | |
85 | void set_selection_owner (rxvt_term *owner); |
|
|
86 | |
|
|
87 | rxvt_xim *get_xim (const char *locale, const char *modifiers); |
106 | rxvt_xim *get_xim (const char *locale, const char *modifiers); |
88 | void put_xim (rxvt_xim *xim); |
107 | void put_xim (rxvt_xim *xim); |
|
|
108 | #endif |
|
|
109 | |
|
|
110 | Atom atom (const char *name); |
89 | }; |
111 | }; |
90 | |
112 | |
|
|
113 | #ifdef USE_XIM |
91 | struct im_watcher : watcher, callback0<void> { |
114 | struct im_watcher : watcher, callback0<void> { |
92 | template<class O1, class O2> |
115 | template<class O1, class O2> |
93 | im_watcher (O1 *object, void (O2::*method) ()) |
116 | im_watcher (O1 *object, void (O2::*method) ()) |
94 | : callback0<void> (object,method) |
117 | : callback0<void> (object,method) |
95 | { } |
118 | { } |
… | |
… | |
101 | void stop (rxvt_display *display) |
124 | void stop (rxvt_display *display) |
102 | { |
125 | { |
103 | display->unreg (this); |
126 | display->unreg (this); |
104 | } |
127 | } |
105 | }; |
128 | }; |
|
|
129 | #endif |
106 | |
130 | |
107 | struct xevent_watcher : watcher, callback1<void, XEvent &> { |
131 | struct xevent_watcher : watcher, callback1<void, XEvent &> { |
108 | Window window; |
132 | Window window; |
109 | |
133 | |
110 | template<class O1, class O2> |
134 | template<class O1, class O2> |
… | |
… | |
145 | |
169 | |
146 | bool set (rxvt_display *display, Pixel p); |
170 | bool set (rxvt_display *display, Pixel p); |
147 | bool set (rxvt_display *display, const char *name); |
171 | bool set (rxvt_display *display, const char *name); |
148 | bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); |
172 | bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); |
149 | |
173 | |
|
|
174 | rxvt_color fade (rxvt_display *, int percent); |
|
|
175 | |
150 | void free (rxvt_display *display); |
176 | void free (rxvt_display *display); |
151 | }; |
177 | }; |
152 | |
178 | |
153 | #endif |
179 | #endif |
154 | |
180 | |