… | |
… | |
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 | io_manager_vec<xevent_watcher> xw; |
68 | io_manager_vec<xevent_watcher> xw; |
56 | |
69 | |
57 | 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); |
58 | |
71 | |
|
|
72 | #ifdef USE_XIM |
59 | refcache<rxvt_xim> xims; |
73 | refcache<rxvt_xim> xims; |
60 | vector<im_watcher *> imw; |
74 | vector<im_watcher *> imw; |
61 | |
75 | |
62 | void im_change_cb (); |
76 | void im_change_cb (); |
|
|
77 | #endif |
63 | |
78 | |
64 | //public |
79 | //public |
65 | Display *display; |
80 | Display *display; |
66 | int depth; |
81 | int depth; |
67 | int screen; |
82 | int screen; |
… | |
… | |
74 | bool init (); |
89 | bool init (); |
75 | ~rxvt_display (); |
90 | ~rxvt_display (); |
76 | |
91 | |
77 | void flush (); |
92 | void flush (); |
78 | |
93 | |
|
|
94 | void set_selection_owner (rxvt_term *owner); |
|
|
95 | |
79 | void reg (xevent_watcher *w); |
96 | void reg (xevent_watcher *w); |
80 | void unreg (xevent_watcher *w); |
97 | void unreg (xevent_watcher *w); |
|
|
98 | |
|
|
99 | #ifdef USE_XIM |
81 | void reg (im_watcher *w); |
100 | void reg (im_watcher *w); |
82 | void unreg (im_watcher *w); |
101 | void unreg (im_watcher *w); |
83 | |
102 | |
84 | void set_selection_owner (rxvt_term *owner); |
|
|
85 | |
|
|
86 | rxvt_xim *get_xim (const char *locale, const char *modifiers); |
103 | rxvt_xim *get_xim (const char *locale, const char *modifiers); |
87 | void put_xim (rxvt_xim *xim); |
104 | void put_xim (rxvt_xim *xim); |
|
|
105 | #endif |
|
|
106 | |
|
|
107 | Atom atom (const char *name); |
88 | }; |
108 | }; |
89 | |
109 | |
|
|
110 | #ifdef USE_XIM |
90 | struct im_watcher : watcher, callback0<void> { |
111 | struct im_watcher : watcher, callback0<void> { |
91 | template<class O1, class O2> |
112 | template<class O1, class O2> |
92 | im_watcher (O1 *object, void (O2::*method) ()) |
113 | im_watcher (O1 *object, void (O2::*method) ()) |
93 | : callback0<void> (object,method) |
114 | : callback0<void> (object,method) |
94 | { } |
115 | { } |
… | |
… | |
100 | void stop (rxvt_display *display) |
121 | void stop (rxvt_display *display) |
101 | { |
122 | { |
102 | display->unreg (this); |
123 | display->unreg (this); |
103 | } |
124 | } |
104 | }; |
125 | }; |
|
|
126 | #endif |
105 | |
127 | |
106 | struct xevent_watcher : watcher, callback1<void, XEvent &> { |
128 | struct xevent_watcher : watcher, callback1<void, XEvent &> { |
107 | Window window; |
129 | Window window; |
108 | |
130 | |
109 | template<class O1, class O2> |
131 | template<class O1, class O2> |