ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvttoolkit.h
(Generate patch)

Comparing rxvt-unicode/src/rxvttoolkit.h (file contents):
Revision 1.2 by root, Wed Aug 25 02:33:09 2004 UTC vs.
Revision 1.14 by root, Mon Jan 30 02:21:21 2006 UTC

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
21enum {
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 XA_AVERAGE_WIDTH,
34 XA_WEIGHT_NAME,
35 XA_SLANT,
36 XA_CHARSET_REGISTRY,
37 XA_CHARSET_ENCODING,
38#if ENABLE_FRILLS
39 XA_MOTIF_WM_HINTS,
40#endif
41#if ENABLE_EWMH
42 XA_NET_WM_PID,
43 XA_NET_WM_NAME,
44 XA_NET_WM_ICON_NAME,
45 XA_NET_WM_PING,
46#endif
47#if USE_XIM
48 XA_WM_LOCALE_NAME,
49 XA_XIM_SERVERS,
50#endif
51#if TRANSPARENT
52 XA_XROOTPMAP_ID,
53 XA_ESETROOT_PMAP_ID,
54#endif
55#if ENABLE_XEMBED
56 XA_XEMBED,
57 XA_XEMBED_INFO,
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#endif
68 NUM_XA
69};
70
20struct rxvt_term; 71struct rxvt_term;
21struct rxvt_display; 72struct rxvt_display;
22 73
23struct im_watcher; 74struct im_watcher;
24struct xevent_watcher; 75struct xevent_watcher;
26struct refcounted { 77struct refcounted {
27 int referenced; 78 int referenced;
28 char *id; 79 char *id;
29 80
30 refcounted (const char *id); 81 refcounted (const char *id);
31 bool init () { return false; } 82 bool ref_init () { return false; }
83 void ref_next () { }
32 ~refcounted (); 84 ~refcounted ();
33}; 85};
34 86
35template<class T> 87template<class T>
36struct refcache : vector<T *> { 88struct refcache : vector<T *> {
37 T *get (const char *id); 89 T *get (const char *id);
38 void put (T *obj); 90 void put (T *obj);
91 void clear ();
92
39 ~refcache (); 93 ~refcache ()
94 {
95 clear ();
96 }
40}; 97};
41 98
42///////////////////////////////////////////////////////////////////////////// 99/////////////////////////////////////////////////////////////////////////////
43 100
44#ifdef USE_XIM 101#ifdef USE_XIM
48 105
49//public 106//public
50 XIM xim; 107 XIM xim;
51 108
52 rxvt_xim (const char *id) : refcounted (id) { } 109 rxvt_xim (const char *id) : refcounted (id) { }
53 bool init (); 110 bool ref_init ();
54 ~rxvt_xim (); 111 ~rxvt_xim ();
55}; 112};
56#endif 113#endif
57 114
115struct rxvt_screen {
116 rxvt_display *display;
117 Display *xdisp;
118 int depth;
119 Visual *visual;
120 Colormap cmap;
121
122 void set (rxvt_display *disp);
123 void set (rxvt_display *disp, int bitdepth);
124 void clear ();
125};
126
58struct rxvt_display : refcounted { 127struct rxvt_display : refcounted {
59 Atom xa_xim_servers;
60
61 io_manager_vec<xevent_watcher> xw; 128 io_manager_vec<xevent_watcher> xw;
62 129
63 io_watcher x_ev; void x_cb (io_watcher &w, short revents); 130 io_watcher x_ev; void x_cb (io_watcher &w, short revents);
64 131
65#ifdef USE_XIM 132#ifdef USE_XIM
66 refcache<rxvt_xim> xims; 133 refcache<rxvt_xim> xims;
67 vector<im_watcher *> imw; 134 vector<im_watcher *> imw;
68 135
69 void im_change_cb (); 136 void im_change_cb ();
137 void im_change_check ();
70#endif 138#endif
71 139
72//public 140//public
73 Display *display; 141 Display *display;
74 int depth;
75 int screen; 142 int screen;
76 Visual *visual;
77 Colormap cmap;
78 Window root; 143 Window root;
79 rxvt_term *selection_owner; 144 rxvt_term *selection_owner;
145 Atom xa[NUM_XA];
80#ifndef NO_SLOW_LINK_SUPPORT 146#ifndef NO_SLOW_LINK_SUPPORT
81 bool is_local; 147 bool is_local;
148#endif
149#ifdef POINTER_BLANK
150 Cursor blank_cursor;
82#endif 151#endif
83 152
84 rxvt_display (const char *id); 153 rxvt_display (const char *id);
154 XrmDatabase get_resources ();
85 bool init (); 155 bool ref_init ();
156 void ref_next ();
86 ~rxvt_display (); 157 ~rxvt_display ();
87 158
88 void flush (); 159 void flush ();
89 160 Atom atom (const char *name);
90 void set_selection_owner (rxvt_term *owner); 161 void set_selection_owner (rxvt_term *owner);
91 162
92 void reg (xevent_watcher *w); 163 void reg (xevent_watcher *w);
93 void unreg (xevent_watcher *w); 164 void unreg (xevent_watcher *w);
94 165
97 void unreg (im_watcher *w); 168 void unreg (im_watcher *w);
98 169
99 rxvt_xim *get_xim (const char *locale, const char *modifiers); 170 rxvt_xim *get_xim (const char *locale, const char *modifiers);
100 void put_xim (rxvt_xim *xim); 171 void put_xim (rxvt_xim *xim);
101#endif 172#endif
102
103 Atom atom (const char *name);
104}; 173};
105 174
106#ifdef USE_XIM 175#ifdef USE_XIM
107struct im_watcher : watcher, callback0<void> { 176struct im_watcher : watcher, callback0<void> {
108 template<class O1, class O2> 177 template<class O1, class O2>
143extern refcache<rxvt_display> displays; 212extern refcache<rxvt_display> displays;
144 213
145///////////////////////////////////////////////////////////////////////////// 214/////////////////////////////////////////////////////////////////////////////
146 215
147typedef unsigned long Pixel; 216typedef unsigned long Pixel;
217
218struct rxvt_rgba {
219 unsigned short r, g, b, a;
220
221 enum { MIN_CC = 0x0000, MAX_CC = 0xffff };
222
223 rxvt_rgba ()
224 { }
225
226 rxvt_rgba (unsigned short r, unsigned short g, unsigned short b, unsigned short a = MAX_CC)
227 : r(r), g(g), b(b), a(a)
228 { }
229};
148 230
149struct rxvt_color { 231struct rxvt_color {
150#if XFT 232#if XFT
151 XftColor c; 233 XftColor c;
152 operator Pixel () const { return c.pixel; } 234 operator Pixel () const { return c.pixel; }
156#endif 238#endif
157 239
158 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); } 240 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); }
159 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); } 241 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); }
160 242
161 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); 243 void get (rxvt_screen *screen, rxvt_rgba &rgba);
162 244
163 bool set (rxvt_display *display, Pixel p);
164 bool set (rxvt_display *display, const char *name); 245 bool set (rxvt_screen *screen, const char *name);
165 bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); 246 bool set (rxvt_screen *screen, rxvt_rgba rgba);
166 247
167 rxvt_color fade (rxvt_display *, int percent); 248 rxvt_color fade (rxvt_screen *screen, int percent); // fades to black
249 rxvt_color fade (rxvt_screen *screen, int percent, rxvt_color &fadeto);
168 250
169 void free (rxvt_display *display); 251 void free (rxvt_screen *screen);
170}; 252};
171 253
172#endif 254#endif
173 255

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines