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

Comparing rxvt-unicode/src/rxvtcolor.C (file contents):
Revision 1.6 by pcg, Wed Feb 11 08:13:45 2004 UTC vs.
Revision 1.7 by pcg, Thu Feb 12 01:42:03 2004 UTC

102 102
103///////////////////////////////////////////////////////////////////////////// 103/////////////////////////////////////////////////////////////////////////////
104 104
105rxvt_display::rxvt_display (const char *id) 105rxvt_display::rxvt_display (const char *id)
106: refcounted (id) 106: refcounted (id)
107, x_watcher (this, &rxvt_display::x_event) 107, x_ev (this, &rxvt_display::x_cb)
108, selection_owner (0) 108, selection_owner (0)
109{ 109{
110} 110}
111 111
112bool rxvt_display::init () 112bool rxvt_display::init ()
137 } 137 }
138 } 138 }
139#endif 139#endif
140 140
141 int fd = XConnectionNumber (display); 141 int fd = XConnectionNumber (display);
142 x_watcher.start (fd, EVENT_READ); 142 x_ev.start (fd, EVENT_READ);
143 fcntl (fd, F_SETFL, FD_CLOEXEC); 143 fcntl (fd, F_SETFL, FD_CLOEXEC);
144 144
145 XSelectInput (display, root, PropertyChangeMask); 145 XSelectInput (display, root, PropertyChangeMask);
146 xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0); 146 xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0);
147 147
148 flush ();
149
148 return true; 150 return true;
149} 151}
150 152
151rxvt_display::~rxvt_display () 153rxvt_display::~rxvt_display ()
152{ 154{
153 x_watcher.stop (); 155 x_ev.stop ();
154 156
155 XCloseDisplay (display); 157 XCloseDisplay (display);
156} 158}
157 159
158void rxvt_display::im_change_cb () 160void rxvt_display::im_change_cb ()
159{ 161{
160 for (im_watcher **i = imw.begin (); i != imw.end (); ++i) 162 for (im_watcher **i = imw.begin (); i != imw.end (); ++i)
161 (*i)->call (); 163 (*i)->call ();
162} 164}
163 165
164void rxvt_display::x_event (io_watcher &w, short revents) 166void rxvt_display::x_cb (io_watcher &w, short revents)
165{ 167{
166 do 168 do
167 { 169 {
168 XEvent xev; 170 XEvent xev;
169 XNextEvent (display, &xev); 171 XNextEvent (display, &xev);
182 else if (xw[i]->window == xev.xany.window) 184 else if (xw[i]->window == xev.xany.window)
183 xw[i]->call (xev); 185 xw[i]->call (xev);
184 } 186 }
185 } 187 }
186 while (XPending (display)); 188 while (XPending (display));
189
190 flush ();
191}
192
193void rxvt_display::flush ()
194{
195 for (;;)
196 {
197 XFlush (display);
198
199 if (!XPending (display))
200 break;
201
202 x_cb (x_ev, 0);
203 }
187} 204}
188 205
189void rxvt_display::reg (xevent_watcher *w) 206void rxvt_display::reg (xevent_watcher *w)
190{ 207{
191 xw.push_back (w); 208 xw.push_back (w);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines