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.11 by pcg, Tue Mar 30 14:45:13 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_watcher; void x_event (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;
62 vector<im_watcher *> imw; 71 vector<im_watcher *> imw;
63 72
64 void im_change_cb (); 73 void im_change_cb ();
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 ();
87
88 void flush ();
77 89
78 void reg (xevent_watcher *w); 90 void reg (xevent_watcher *w);
79 void unreg (xevent_watcher *w); 91 void unreg (xevent_watcher *w);
80 void reg (im_watcher *w); 92 void reg (im_watcher *w);
81 void unreg (im_watcher *w); 93 void unreg (im_watcher *w);
82 94
83 void set_selection_owner (rxvt_term *owner); 95 void set_selection_owner (rxvt_term *owner);
84 96
85 rxvt_xim *get_xim (const char *locale, const char *modifiers); 97 rxvt_xim *get_xim (const char *locale, const char *modifiers);
86 void put_xim (rxvt_xim *xim); 98 void put_xim (rxvt_xim *xim);
99
100 Atom atom (const char *name);
87}; 101};
88 102
89struct im_watcher : watcher, callback0<void> { 103struct im_watcher : watcher, callback0<void> {
90 template<class O1, class O2> 104 template<class O1, class O2>
91 im_watcher (O1 *object, void (O2::*method)()) 105 im_watcher (O1 *object, void (O2::*method) ())
92 : callback0<void>(object,method) 106 : callback0<void> (object,method)
93 { } 107 { }
94 108
95 void start (rxvt_display *display) 109 void start (rxvt_display *display)
96 { 110 {
97 display->reg (this); 111 display->reg (this);
104 118
105struct xevent_watcher : watcher, callback1<void, XEvent &> { 119struct xevent_watcher : watcher, callback1<void, XEvent &> {
106 Window window; 120 Window window;
107 121
108 template<class O1, class O2> 122 template<class O1, class O2>
109 xevent_watcher (O1 *object, void (O2::*method)(XEvent &)) 123 xevent_watcher (O1 *object, void (O2::*method) (XEvent &))
110 : callback1<void, XEvent &>(object,method) 124 : callback1<void, XEvent &> (object,method)
111 { } 125 { }
112 126
113 void start (rxvt_display *display, Window window) 127 void start (rxvt_display *display, Window window)
114 { 128 {
115 this->window = window; 129 this->window = window;
128typedef unsigned long Pixel; 142typedef unsigned long Pixel;
129 143
130struct rxvt_color { 144struct rxvt_color {
131#if XFT 145#if XFT
132 XftColor c; 146 XftColor c;
133 operator Pixel() const { return c.pixel; } 147 operator Pixel () const { return c.pixel; }
134#else 148#else
135 Pixel p; 149 Pixel p;
136 operator Pixel() const { return p; } 150 operator Pixel () const { return p; }
137#endif 151#endif
138 152
139 bool operator == (const rxvt_color &b) const { return Pixel(*this) == Pixel(b); } 153 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); } 154 bool operator != (const rxvt_color &b) const { return Pixel (*this) != Pixel (b); }
141 155
142 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb); 156 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb);
143 157
144 bool set (rxvt_display *display, Pixel p); 158 bool set (rxvt_display *display, Pixel p);
145 bool set (rxvt_display *display, const char *name); 159 bool set (rxvt_display *display, const char *name);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines