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.4 by pcg, Tue Feb 10 00:40:39 2004 UTC vs.
Revision 1.5 by pcg, Wed Feb 11 08:13:45 2004 UTC

14 14
15#include "callback.h" 15#include "callback.h"
16 16
17struct rxvt_term; 17struct rxvt_term;
18 18
19struct im_watcher;
19struct xevent_watcher; 20struct xevent_watcher;
20 21
21struct rxvt_display { 22struct refcounted {
22 int referenced; 23 int referenced;
23 char *name; 24 char *id;
25
26 refcounted (const char *id);
27 bool init () { }
28 ~refcounted ();
29};
30
31template<class T>
32struct refcache : vector<T *> {
33 T *get (const char *id);
34 void put (T *obj);
35 ~refcache ();
36};
37
38/////////////////////////////////////////////////////////////////////////////
39
40struct rxvt_xim : refcounted {
41 void destroy ();
42 rxvt_display *display;
43
44//public
45 XIM xim;
46
47 rxvt_xim (const char *id) : refcounted (id) { }
48 bool init ();
49 ~rxvt_xim ();
50};
51
52struct rxvt_display : refcounted {
53 Atom xa_xim_servers;
24 54
25 rxvt_term *selection_owner; 55 rxvt_term *selection_owner;
26 56
27 io_manager_vec<xevent_watcher> xw; 57 io_manager_vec<xevent_watcher> xw;
58
28 io_watcher x_watcher; void x_event (io_watcher &w, short revents); 59 io_watcher x_watcher; void x_event (io_watcher &w, short revents);
60
61 refcache<rxvt_xim> xims;
62 vector<im_watcher *> imw;
63
64 void im_change_cb ();
29 65
30//public 66//public
31 Display *display; 67 Display *display;
32 int depth; 68 int depth;
33 int screen; 69 int screen;
34 Visual *visual; 70 Visual *visual;
35 Colormap cmap; 71 Colormap cmap;
36 Window root; 72 Window root;
37 73
74 rxvt_display (const char *id);
38 bool open (); 75 bool init ();
39 void close (); 76 ~rxvt_display ();
40 77
41 void reg (xevent_watcher *w); 78 void reg (xevent_watcher *w);
42 void unreg (xevent_watcher *w); 79 void unreg (xevent_watcher *w);
43 80 void reg (im_watcher *w);
44 rxvt_display (const char *name); 81 void unreg (im_watcher *w);
45 ~rxvt_display ();
46 82
47 void set_selection_owner (rxvt_term *owner); 83 void set_selection_owner (rxvt_term *owner);
84
85 rxvt_xim *get_xim (const char *locale, const char *modifiers);
86 void put_xim (rxvt_xim *xim);
87};
88
89struct im_watcher : watcher, callback0<void> {
90 template<class O1, class O2>
91 im_watcher (O1 *object, void (O2::*method)())
92 : callback0<void>(object,method)
93 { }
94
95 void start (rxvt_display *display)
96 {
97 display->reg (this);
98 }
99 void stop (rxvt_display *display)
100 {
101 display->unreg (this);
102 }
48}; 103};
49 104
50struct xevent_watcher : watcher, callback1<void, XEvent &> { 105struct xevent_watcher : watcher, callback1<void, XEvent &> {
51 Window window; 106 Window window;
52 107
64 { 119 {
65 display->unreg (this); 120 display->unreg (this);
66 } 121 }
67}; 122};
68 123
69struct rxvt_displays { 124extern refcache<rxvt_display> displays;
70 vector<rxvt_display *> list;
71
72 rxvt_display *get (const char *name);
73 void release (rxvt_display *display);
74};
75 125
76extern rxvt_displays displays; 126/////////////////////////////////////////////////////////////////////////////
77 127
78typedef unsigned long Pixel; 128typedef unsigned long Pixel;
79 129
80struct rxvt_color { 130struct rxvt_color {
81#if XFT 131#if XFT

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines