--- rxvt-unicode/src/rxvttoolkit.C 2004/12/11 17:18:29 1.6 +++ rxvt-unicode/src/rxvttoolkit.C 2005/08/05 16:42:44 1.17 @@ -84,7 +84,7 @@ } template -refcache::~refcache () +void refcache::clear () { while (this->size ()) put (*this->begin ()); @@ -145,7 +145,21 @@ bool rxvt_display::init () { - display = XOpenDisplay (id); +#ifdef LOCAL_X_IS_UNIX + if (id[0] == ':') + { + val = rxvt_malloc (5 + strlen (id) + 1); + strcpy (val, "unix/"); + strcat (val, id); + display = XOpenDisplay (val); + free (val); + } + else +#endif + display = 0; + + if (!display) + display = XOpenDisplay (id); if (!display) return false; @@ -159,7 +173,7 @@ int fd = XConnectionNumber (display); #ifndef NO_SLOW_LINK_SUPPORT - // try to detetc wether we have a local connection. + // try to detect wether we have a local connection. // assume unix domains socket == local, everything else not // TODO: might want to check for inet/127.0.0.1 is_local = 0; @@ -170,6 +184,17 @@ is_local = sa.sun_family == AF_LOCAL; #endif +#ifdef POINTER_BLANK + XColor blackcolour; + blackcolour.red = 0; + blackcolour.green = 0; + blackcolour.blue = 0; + Font f = XLoadFont (display, "fixed"); + blank_cursor = XCreateGlyphCursor (display, f, f, ' ', ' ', + &blackcolour, &blackcolour); + XUnloadFont (display, f); +#endif + #ifdef PREFER_24BIT /* * If depth is not 24, look for a 24bit visual. @@ -205,6 +230,9 @@ rxvt_display::~rxvt_display () { x_ev.stop (); +#ifdef USE_XIM + xims.clear (); +#endif if (display) XCloseDisplay (display); @@ -219,7 +247,7 @@ void rxvt_display::im_change_check () { - // make sure we only call im_change_cb when a new input method + // try to only call im_change_cb when a new input method // registers, as xlib crashes due to a race otherwise. Atom actual_type, *atoms; int actual_format; @@ -272,18 +300,15 @@ } while (XEventsQueued (display, QueuedAlready)); - flush (); + XFlush (display); } void rxvt_display::flush () { - for (;;) - { - if (!XPending (display)) - break; + if (XEventsQueued (display, QueuedAlready)) + x_cb (x_ev, EVENT_READ); - x_cb (x_ev, 0); - } + XFlush (display); } void rxvt_display::reg (xevent_watcher *w) @@ -340,7 +365,9 @@ void rxvt_display::put_xim (rxvt_xim *xim) { +#if XLIB_IS_RACEFREE xims.put (xim); +#endif } #endif @@ -388,12 +415,17 @@ bool rxvt_color::set (rxvt_display *display, const char *name) { +#if XFT + return XftColorAllocName (display->display, display->visual, display->cmap, + name, &c); +#else XColor xc; if (XParseColor (display->display, display->cmap, name, &xc)) return set (display, xc.red, xc.green, xc.blue); return false; +#endif } bool