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.1 by pcg, Mon Nov 24 17:28:08 2003 UTC vs.
Revision 1.4 by pcg, Tue Feb 10 00:40:39 2004 UTC

5 5
6#if XFT 6#if XFT
7# include <X11/Xft/Xft.h> 7# include <X11/Xft/Xft.h>
8#endif 8#endif
9 9
10#include "iom.h"
11
10#include "rxvtlib.h" 12#include "rxvtlib.h"
13#include "rxvtstl.h"
11 14
15#include "callback.h"
16
12struct rxvt_vars; 17struct rxvt_term;
18
19struct xevent_watcher;
20
21struct rxvt_display {
22 int referenced;
23 char *name;
24
25 rxvt_term *selection_owner;
26
27 io_manager_vec<xevent_watcher> xw;
28 io_watcher x_watcher; void x_event (io_watcher &w, short revents);
29
30//public
31 Display *display;
32 int depth;
33 int screen;
34 Visual *visual;
35 Colormap cmap;
36 Window root;
37
38 bool open ();
39 void close ();
40
41 void reg (xevent_watcher *w);
42 void unreg (xevent_watcher *w);
43
44 rxvt_display (const char *name);
45 ~rxvt_display ();
46
47 void set_selection_owner (rxvt_term *owner);
48};
49
50struct xevent_watcher : watcher, callback1<void, XEvent &> {
51 Window window;
52
53 template<class O1, class O2>
54 xevent_watcher (O1 *object, void (O2::*method)(XEvent &))
55 : callback1<void, XEvent &>(object,method)
56 { }
57
58 void start (rxvt_display *display, Window window)
59 {
60 this->window = window;
61 display->reg (this);
62 }
63 void stop (rxvt_display *display)
64 {
65 display->unreg (this);
66 }
67};
68
69struct rxvt_displays {
70 vector<rxvt_display *> list;
71
72 rxvt_display *get (const char *name);
73 void release (rxvt_display *display);
74};
75
76extern rxvt_displays displays;
13 77
14typedef unsigned long Pixel; 78typedef unsigned long Pixel;
15 79
16struct rxvt_color { 80struct rxvt_color {
17#if XFT 81#if XFT
18 XftColor c; 82 XftColor c;
19 operator Pixel() const { return c.pixel; } 83 operator Pixel() const { return c.pixel; }
20#else 84#else
21 Pixel p; 85 Pixel p;
22 operator Pixel() const { return p; } 86 operator Pixel() const { return p; }
23#endif 87#endif
24 88
25 bool operator == (const rxvt_color &b) const { return Pixel(*this) == Pixel(b); } 89 bool operator == (const rxvt_color &b) const { return Pixel(*this) == Pixel(b); }
26 bool operator != (const rxvt_color &b) const { return Pixel(*this) != Pixel(b); } 90 bool operator != (const rxvt_color &b) const { return Pixel(*this) != Pixel(b); }
27 91
28 void get (pR_ unsigned short &cr, unsigned short &cg, unsigned short &cb); 92 void get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb);
29 93
30 bool set (pR_ Pixel p); 94 bool set (rxvt_display *display, Pixel p);
31 bool set (pR_ const char *name); 95 bool set (rxvt_display *display, const char *name);
32 bool set (pR_ unsigned short cr, unsigned short cg, unsigned short cb); 96 bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb);
97
98 void free (rxvt_display *display);
33}; 99};
34 100
35#endif 101#endif
36 102

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines