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

Comparing rxvt-unicode/src/rxvtcolor.h (file contents):
Revision 1.5 by pcg, Wed Feb 11 08:13:45 2004 UTC vs.
Revision 1.14 by root, Wed Aug 4 03:29:28 2004 UTC

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 16
17extern class byteorder {
18 uint32_t e;
19public:
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;
27
17struct rxvt_term; 28struct rxvt_term;
18 29
19struct im_watcher; 30struct im_watcher;
20struct xevent_watcher; 31struct xevent_watcher;
21 32
22struct refcounted { 33struct refcounted {
23 int referenced; 34 int referenced;
24 char *id; 35 char *id;
25 36
26 refcounted (const char *id); 37 refcounted (const char *id);
27 bool init () { } 38 bool init () { return false; }
28 ~refcounted (); 39 ~refcounted ();
29}; 40};
30 41
31template<class T> 42template<class T>
32struct refcache : vector<T *> { 43struct refcache : vector<T *> {
35 ~refcache (); 46 ~refcache ();
36}; 47};
37 48
38///////////////////////////////////////////////////////////////////////////// 49/////////////////////////////////////////////////////////////////////////////
39 50
51#ifdef USE_XIM
40struct rxvt_xim : refcounted { 52struct 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
52struct rxvt_display : refcounted { 65struct 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_watcher; void x_event (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
95 void flush ();
96
97 void set_selection_owner (rxvt_term *owner);
98
78 void reg (xevent_watcher *w); 99 void reg (xevent_watcher *w);
79 void unreg (xevent_watcher *w); 100 void unreg (xevent_watcher *w);
101
102#ifdef USE_XIM
80 void reg (im_watcher *w); 103 void reg (im_watcher *w);
81 void unreg (im_watcher *w); 104 void unreg (im_watcher *w);
82 105
83 void set_selection_owner (rxvt_term *owner);
84
85 rxvt_xim *get_xim (const char *locale, const char *modifiers); 106 rxvt_xim *get_xim (const char *locale, const char *modifiers);
86 void put_xim (rxvt_xim *xim); 107 void put_xim (rxvt_xim *xim);
108#endif
109
110 Atom atom (const char *name);
87}; 111};
88 112
113#ifdef USE_XIM
89struct im_watcher : watcher, callback0<void> { 114struct im_watcher : watcher, callback0<void> {
90 template<class O1, class O2> 115 template<class O1, class O2>
91 im_watcher (O1 *object, void (O2::*method)()) 116 im_watcher (O1 *object, void (O2::*method) ())
92 : callback0<void>(object,method) 117 : callback0<void> (object,method)
93 { } 118 { }
94 119
95 void start (rxvt_display *display) 120 void start (rxvt_display *display)
96 { 121 {
97 display->reg (this); 122 display->reg (this);
99 void stop (rxvt_display *display) 124 void stop (rxvt_display *display)
100 { 125 {
101 display->unreg (this); 126 display->unreg (this);
102 } 127 }
103}; 128};
129#endif
104 130
105struct xevent_watcher : watcher, callback1<void, XEvent &> { 131struct xevent_watcher : watcher, callback1<void, XEvent &> {
106 Window window; 132 Window window;
107 133
108 template<class O1, class O2> 134 template<class O1, class O2>
109 xevent_watcher (O1 *object, void (O2::*method)(XEvent &)) 135 xevent_watcher (O1 *object, void (O2::*method) (XEvent &))
110 : callback1<void, XEvent &>(object,method) 136 : callback1<void, XEvent &> (object,method)
111 { } 137 { }
112 138
113 void start (rxvt_display *display, Window window) 139 void start (rxvt_display *display, Window window)
114 { 140 {
115 this->window = window; 141 this->window = window;
128typedef unsigned long Pixel; 154typedef unsigned long Pixel;
129 155
130struct rxvt_color { 156struct rxvt_color {
131#if XFT 157#if XFT
132 XftColor c; 158 XftColor c;
133 operator Pixel() const { return c.pixel; } 159 operator Pixel () const { return c.pixel; }
134#else 160#else
135 Pixel p; 161 Pixel p;
136 operator Pixel() const { return p; } 162 operator Pixel () const { return p; }
137#endif 163#endif
138 164
139 bool operator == (const rxvt_color &b) const { return Pixel(*this) == Pixel(b); } 165 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); }
140 bool operator != (const rxvt_color &b) const { return Pixel(*this) != Pixel(b); } 166 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); }
141 167
142 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); 168 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb);
143 169
144 bool set (rxvt_display *display, Pixel p); 170 bool set (rxvt_display *display, Pixel p);
145 bool set (rxvt_display *display, const char *name); 171 bool set (rxvt_display *display, const char *name);
146 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);
147 173
174 rxvt_color fade (rxvt_display *, int percent);
175
148 void free (rxvt_display *display); 176 void free (rxvt_display *display);
149}; 177};
150 178
151#endif 179#endif
152 180

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines