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

Comparing rxvt-unicode/src/rxvttoolkit.C (file contents):
Revision 1.5 by root, Tue Sep 7 12:34:05 2004 UTC vs.
Revision 1.15 by root, Wed Jul 13 00:51:25 2005 UTC

82 delete obj; 82 delete obj;
83 } 83 }
84} 84}
85 85
86template<class T> 86template<class T>
87refcache<T>::~refcache () 87void refcache<T>::clear ()
88{ 88{
89 while (this->size ()) 89 while (this->size ())
90 put (*this->begin ()); 90 put (*this->begin ());
91} 91}
92 92
143{ 143{
144} 144}
145 145
146bool rxvt_display::init () 146bool rxvt_display::init ()
147{ 147{
148#ifdef LOCAL_X_IS_UNIX
149 if (id[0] == ':')
150 {
151 val = rxvt_malloc (5 + strlen (id) + 1);
152 strcpy (val, "unix/");
153 strcat (val, id);
154 display = XOpenDisplay (val);
155 printf ("OD %s => %p\n", val, display);//D
156 free (val);
157 }
158 else
159#endif
160 display = 0;
161
162 if (!display)
148 display = XOpenDisplay (id); 163 display = XOpenDisplay (id);
164 printf ("O2 %s => %p\n", id, display);//D
149 165
150 if (!display) 166 if (!display)
151 return false; 167 return false;
152 168
153 screen = DefaultScreen (display); 169 screen = DefaultScreen (display);
166 sockaddr_un sa; 182 sockaddr_un sa;
167 socklen_t sl = sizeof (sa); 183 socklen_t sl = sizeof (sa);
168 184
169 if (!getsockname (fd, (sockaddr *)&sa, &sl)) 185 if (!getsockname (fd, (sockaddr *)&sa, &sl))
170 is_local = sa.sun_family == AF_LOCAL; 186 is_local = sa.sun_family == AF_LOCAL;
187#endif
188
189#ifdef POINTER_BLANK
190 XColor blackcolour;
191 blackcolour.red = 0;
192 blackcolour.green = 0;
193 blackcolour.blue = 0;
194 Font f = XLoadFont (display, "fixed");
195 blank_cursor = XCreateGlyphCursor (display, f, f, ' ', ' ',
196 &blackcolour, &blackcolour);
197 XUnloadFont (display, f);
171#endif 198#endif
172 199
173#ifdef PREFER_24BIT 200#ifdef PREFER_24BIT
174 /* 201 /*
175 * If depth is not 24, look for a 24bit visual. 202 * If depth is not 24, look for a 24bit visual.
203} 230}
204 231
205rxvt_display::~rxvt_display () 232rxvt_display::~rxvt_display ()
206{ 233{
207 x_ev.stop (); 234 x_ev.stop ();
235#ifdef USE_XIM
236 xims.clear ();
237#endif
208 238
209 if (display) 239 if (display)
210 XCloseDisplay (display); 240 XCloseDisplay (display);
211} 241}
212 242
217 (*i)->call (); 247 (*i)->call ();
218} 248}
219 249
220void rxvt_display::im_change_check () 250void rxvt_display::im_change_check ()
221{ 251{
222 // make sure we only call im_change_cb when a new input method 252 // try to only call im_change_cb when a new input method
223 // registers, as xlib crashes due to a race otherwise. 253 // registers, as xlib crashes due to a race otherwise.
224 Atom actual_type, *atoms; 254 Atom actual_type, *atoms;
225 int actual_format; 255 int actual_format;
226 unsigned long nitems, bytes_after; 256 unsigned long nitems, bytes_after;
227 257
268 } 298 }
269#ifdef USE_XIM 299#ifdef USE_XIM
270 } 300 }
271#endif 301#endif
272 } 302 }
273 while (XPending (display)); 303 while (XEventsQueued (display, QueuedAlready));
274 304
275 flush (); 305 XFlush (display);
276} 306}
277 307
278void rxvt_display::flush () 308void rxvt_display::flush ()
279{ 309{
280 for (;;) 310 if (XEventsQueued (display, QueuedAlready))
281 { 311 x_cb (x_ev, EVENT_READ);
282 if (!XPending (display))
283 break;
284 312
285 x_cb (x_ev, 0); 313 XFlush (display);
286 }
287} 314}
288 315
289void rxvt_display::reg (xevent_watcher *w) 316void rxvt_display::reg (xevent_watcher *w)
290{ 317{
291 xw.push_back (w); 318 xw.push_back (w);
338 return xim; 365 return xim;
339} 366}
340 367
341void rxvt_display::put_xim (rxvt_xim *xim) 368void rxvt_display::put_xim (rxvt_xim *xim)
342{ 369{
370#if XLIB_IS_RACEFREE
343 xims.put (xim); 371 xims.put (xim);
372#endif
344} 373}
345#endif 374#endif
346 375
347Atom rxvt_display::atom (const char *name) 376Atom rxvt_display::atom (const char *name)
348{ 377{
386} 415}
387 416
388bool 417bool
389rxvt_color::set (rxvt_display *display, const char *name) 418rxvt_color::set (rxvt_display *display, const char *name)
390{ 419{
420#if XFT
421 return XftColorAllocName (display->display, display->visual, display->cmap,
422 name, &c);
423#else
391 XColor xc; 424 XColor xc;
392 425
393 if (XParseColor (display->display, display->cmap, name, &xc)) 426 if (XParseColor (display->display, display->cmap, name, &xc))
394 return set (display, xc.red, xc.green, xc.blue); 427 return set (display, xc.red, xc.green, xc.blue);
395 428
396 return false; 429 return false;
430#endif
397} 431}
398 432
399bool 433bool
400rxvt_color::set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb) 434rxvt_color::set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb)
401{ 435{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines