--- rxvt-unicode/src/rxvtcolor.C 2004/02/12 01:42:03 1.7 +++ rxvt-unicode/src/rxvtcolor.C 2004/03/30 14:45:13 1.11 @@ -5,6 +5,23 @@ #include #include +class byteorder byteorder; + +byteorder::byteorder () +{ + union { + uint32_t u; + uint8_t b[4]; + } w; + + w.b[0] = 0x11; + w.b[1] = 0x22; + w.b[2] = 0x33; + w.b[3] = 0x44; + + e = w.u; +} + refcounted::refcounted (const char *id) { this->id = STRDUP (id); @@ -113,6 +130,9 @@ { display = XOpenDisplay (id); + if (!display) + return false; + screen = DefaultScreen (display); root = DefaultRootWindow (display); visual = DefaultVisual (display, screen); @@ -154,7 +174,8 @@ { x_ev.stop (); - XCloseDisplay (display); + if (display) + XCloseDisplay (display); } void rxvt_display::im_change_cb () @@ -253,6 +274,11 @@ xims.put (xim); } +Atom rxvt_display::atom (const char *name) +{ + return XInternAtom (display, name, False); +} + ///////////////////////////////////////////////////////////////////////////// template refcache; @@ -341,7 +367,7 @@ #if XFT XftColorFree (display->display, display->visual, display->cmap, &c); #else - XFreeColors (display->display, display->cmap, &c, 1, AllPlanes); + XFreeColors (display->display, display->cmap, &p, 1, AllPlanes); #endif }