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.6 by pcg, Thu Feb 12 01:42:03 2004 UTC vs.
Revision 1.10 by pcg, Mon Mar 29 21:02:11 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 *> {
50}; 61};
51 62
52struct rxvt_display : refcounted { 63struct rxvt_display : refcounted {
53 Atom xa_xim_servers; 64 Atom xa_xim_servers;
54 65
55 rxvt_term *selection_owner;
56
57 io_manager_vec<xevent_watcher> xw; 66 io_manager_vec<xevent_watcher> xw;
58 67
59 io_watcher x_ev; void x_cb (io_watcher &w, short revents); 68 io_watcher x_ev; void x_cb (io_watcher &w, short revents);
60 69
61 refcache<rxvt_xim> xims; 70 refcache<rxvt_xim> xims;
68 int depth; 77 int depth;
69 int screen; 78 int screen;
70 Visual *visual; 79 Visual *visual;
71 Colormap cmap; 80 Colormap cmap;
72 Window root; 81 Window root;
82 rxvt_term *selection_owner;
73 83
74 rxvt_display (const char *id); 84 rxvt_display (const char *id);
75 bool init (); 85 bool init ();
76 ~rxvt_display (); 86 ~rxvt_display ();
77 87
88 void put_xim (rxvt_xim *xim); 98 void put_xim (rxvt_xim *xim);
89}; 99};
90 100
91struct im_watcher : watcher, callback0<void> { 101struct im_watcher : watcher, callback0<void> {
92 template<class O1, class O2> 102 template<class O1, class O2>
93 im_watcher (O1 *object, void (O2::*method)()) 103 im_watcher (O1 *object, void (O2::*method) ())
94 : callback0<void>(object,method) 104 : callback0<void> (object,method)
95 { } 105 { }
96 106
97 void start (rxvt_display *display) 107 void start (rxvt_display *display)
98 { 108 {
99 display->reg (this); 109 display->reg (this);
106 116
107struct xevent_watcher : watcher, callback1<void, XEvent &> { 117struct xevent_watcher : watcher, callback1<void, XEvent &> {
108 Window window; 118 Window window;
109 119
110 template<class O1, class O2> 120 template<class O1, class O2>
111 xevent_watcher (O1 *object, void (O2::*method)(XEvent &)) 121 xevent_watcher (O1 *object, void (O2::*method) (XEvent &))
112 : callback1<void, XEvent &>(object,method) 122 : callback1<void, XEvent &> (object,method)
113 { } 123 { }
114 124
115 void start (rxvt_display *display, Window window) 125 void start (rxvt_display *display, Window window)
116 { 126 {
117 this->window = window; 127 this->window = window;
130typedef unsigned long Pixel; 140typedef unsigned long Pixel;
131 141
132struct rxvt_color { 142struct rxvt_color {
133#if XFT 143#if XFT
134 XftColor c; 144 XftColor c;
135 operator Pixel() const { return c.pixel; } 145 operator Pixel () const { return c.pixel; }
136#else 146#else
137 Pixel p; 147 Pixel p;
138 operator Pixel() const { return p; } 148 operator Pixel () const { return p; }
139#endif 149#endif
140 150
141 bool operator == (const rxvt_color &b) const { return Pixel(*this) == Pixel(b); } 151 bool operator == (const rxvt_color &b) const { return Pixel (*this) == Pixel (b); }
142 bool operator != (const rxvt_color &b) const { return Pixel(*this) != Pixel(b); } 152 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); }
143 153
144 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); 154 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb);
145 155
146 bool set (rxvt_display *display, Pixel p); 156 bool set (rxvt_display *display, Pixel p);
147 bool set (rxvt_display *display, const char *name); 157 bool set (rxvt_display *display, const char *name);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines