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.15 by root, Sun May 30 19:12:42 2004 UTC vs.
Revision 1.21 by root, Mon Aug 2 04:53:34 2004 UTC

102 put (*this->begin ()); 102 put (*this->begin ());
103} 103}
104 104
105///////////////////////////////////////////////////////////////////////////// 105/////////////////////////////////////////////////////////////////////////////
106 106
107#ifdef USE_XIM
107static void 108static void
109#if XIMCB_PROTO_BROKEN
110im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3)
111#else
108im_destroy_cb (XIM unused1, XPointer client_data, XPointer unused3) 112im_destroy_cb (XIM unused1, XPointer client_data, XPointer unused3)
113#endif
109{ 114{
110 rxvt_xim *xim = (rxvt_xim *)client_data; 115 rxvt_xim *xim = (rxvt_xim *)client_data;
111 rxvt_display *display = xim->display; 116 rxvt_display *display = xim->display;
112 117
113 display->xims.erase (find (display->xims.begin (), display->xims.end (), xim)); 118 display->xims.erase (find (display->xims.begin (), display->xims.end (), xim));
136rxvt_xim::~rxvt_xim () 141rxvt_xim::~rxvt_xim ()
137{ 142{
138 if (xim) 143 if (xim)
139 XCloseIM (xim); 144 XCloseIM (xim);
140} 145}
146#endif
141 147
142///////////////////////////////////////////////////////////////////////////// 148/////////////////////////////////////////////////////////////////////////////
143 149
144rxvt_display::rxvt_display (const char *id) 150rxvt_display::rxvt_display (const char *id)
145: refcounted (id) 151: refcounted (id)
183 int fd = XConnectionNumber (display); 189 int fd = XConnectionNumber (display);
184 x_ev.start (fd, EVENT_READ); 190 x_ev.start (fd, EVENT_READ);
185 fcntl (fd, F_SETFD, FD_CLOEXEC); 191 fcntl (fd, F_SETFD, FD_CLOEXEC);
186 192
187 XSelectInput (display, root, PropertyChangeMask); 193 XSelectInput (display, root, PropertyChangeMask);
194#ifdef USE_XIM
188 xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0); 195 xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0);
196#endif
189 197
190 flush (); 198 flush ();
191 199
192 return true; 200 return true;
193} 201}
198 206
199 if (display) 207 if (display)
200 XCloseDisplay (display); 208 XCloseDisplay (display);
201} 209}
202 210
211#ifdef USE_XIM
203void rxvt_display::im_change_cb () 212void rxvt_display::im_change_cb ()
204{ 213{
205 for (im_watcher **i = imw.begin (); i != imw.end (); ++i) 214 for (im_watcher **i = imw.begin (); i != imw.end (); ++i)
206 (*i)->call (); 215 (*i)->call ();
207} 216}
217#endif
208 218
209void rxvt_display::x_cb (io_watcher &w, short revents) 219void rxvt_display::x_cb (io_watcher &w, short revents)
210{ 220{
211 do 221 do
212 { 222 {
213 XEvent xev; 223 XEvent xev;
214 XNextEvent (display, &xev); 224 XNextEvent (display, &xev);
215 225
216 //printf ("T %d w %lx\n", xev.type, xev.xany.window);//D 226 //printf ("T %d w %lx\n", xev.type, xev.xany.window);//D
217 227
228#ifdef USE_XIM
218 if (xev.type == PropertyNotify 229 if (xev.type == PropertyNotify
219 && xev.xany.window == root 230 && xev.xany.window == root
220 && xev.xproperty.atom == xa_xim_servers) 231 && xev.xproperty.atom == xa_xim_servers)
221 im_change_cb (); 232 im_change_cb ();
233#endif
222 234
223 for (int i = xw.size (); i--; ) 235 for (int i = xw.size (); i--; )
224 { 236 {
225 if (!xw[i]) 237 if (!xw[i])
226 xw.erase_unordered (i); 238 xw.erase_unordered (i);
235 247
236void rxvt_display::flush () 248void rxvt_display::flush ()
237{ 249{
238 for (;;) 250 for (;;)
239 { 251 {
240 XFlush (display);
241
242 if (!XPending (display)) 252 if (!XPending (display))
243 break; 253 break;
244 254
245 x_cb (x_ev, 0); 255 x_cb (x_ev, 0);
246 } 256 }
256{ 266{
257 if (w->active) 267 if (w->active)
258 xw[w->active - 1] = 0; 268 xw[w->active - 1] = 0;
259} 269}
260 270
261void rxvt_display::reg (im_watcher *w)
262{
263 imw.push_back (w);
264}
265
266void rxvt_display::unreg (im_watcher *w)
267{
268 imw.erase (find (imw.begin (), imw.end (), w));
269}
270
271void rxvt_display::set_selection_owner (rxvt_term *owner) 271void rxvt_display::set_selection_owner (rxvt_term *owner)
272{ 272{
273 if (selection_owner && selection_owner != owner) 273 if (selection_owner && selection_owner != owner)
274 selection_owner->selection_clear (); 274 selection_owner->selection_clear ();
275 275
276 selection_owner = owner; 276 selection_owner = owner;
277} 277}
278 278
279#ifdef USE_XIM
280void rxvt_display::reg (im_watcher *w)
281{
282 imw.push_back (w);
283}
284
285void rxvt_display::unreg (im_watcher *w)
286{
287 imw.erase (find (imw.begin (), imw.end (), w));
288}
289
279rxvt_xim *rxvt_display::get_xim (const char *locale, const char *modifiers) 290rxvt_xim *rxvt_display::get_xim (const char *locale, const char *modifiers)
280{ 291{
281 char *id; 292 char *id;
282 int l, m; 293 int l, m;
283 294
299 310
300void rxvt_display::put_xim (rxvt_xim *xim) 311void rxvt_display::put_xim (rxvt_xim *xim)
301{ 312{
302 xims.put (xim); 313 xims.put (xim);
303} 314}
315#endif
304 316
305Atom rxvt_display::atom (const char *name) 317Atom rxvt_display::atom (const char *name)
306{ 318{
307 return XInternAtom (display, name, False); 319 return XInternAtom (display, name, False);
308} 320}
397#else 409#else
398 XFreeColors (display->display, display->cmap, &p, 1, AllPlanes); 410 XFreeColors (display->display, display->cmap, &p, 1, AllPlanes);
399#endif 411#endif
400} 412}
401 413
414rxvt_color
415rxvt_color::fade (rxvt_display *display, int percent)
416{
417 unsigned short cr, cg, cb;
418 rxvt_color faded;
419
420 get (display, cr, cg, cb);
421 faded.set (display,
422 cr * percent / 100,
423 cg * percent / 100,
424 cb * percent / 100);
425
426 return faded;
427}
428

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines