--- rxvt-unicode/src/main.C 2006/01/25 21:03:04 1.206 +++ rxvt-unicode/src/main.C 2006/01/31 19:53:30 1.214 @@ -370,7 +370,7 @@ (*t)->emergency_cleanup (); } -#if ENABLE_FRILLS +#if !ENABLE_MINIMAL static void print_x_error (Display *dpy, XErrorEvent *event) { @@ -428,10 +428,10 @@ { // GET_R is most likely not the terminal which caused the error, // so just output the error and continue -#if ENABLE_FRILLS - print_x_error (display, event); -#else +#if ENABLE_MINIMAL old_xerror_handler (display, event); +#else + print_x_error (display, event); #endif } @@ -516,7 +516,7 @@ { long info[2] = { 0, XEMBED_MAPPED }; - XChangeProperty (display->display, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], + XChangeProperty (xdisp, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], 32, PropModeReplace, (unsigned char *)&info, 2); } #endif @@ -693,6 +693,7 @@ { sb_w = scrollbar_TotalWidth (); szHint.base_width += sb_w; + if (!OPTION (Opt_scrollBar_right)) window_vt_x += sb_w; } @@ -844,7 +845,7 @@ void rxvt_term::set_string_property (Atom prop, const char *str, int len) { - XChangeProperty (display->display, parent[0], + XChangeProperty (xdisp, parent[0], prop, XA_STRING, 8, PropModeReplace, (const unsigned char *)str, len >= 0 ? len : strlen (str)); } @@ -854,7 +855,7 @@ wchar_t *ws = rxvt_mbstowcs (str, len); char *s = rxvt_wcstoutf8 (ws); - XChangeProperty (display->display, parent[0], + XChangeProperty (xdisp, parent[0], prop, xa[XA_UTF8_STRING], 8, PropModeReplace, (const unsigned char *)s, strlen (s)); @@ -889,10 +890,14 @@ { rxvt_color xcol; int i; - + if (color == NULL || *color == '\0') return; + color = strdup (color); + allocated.push_back ((void *)color); + rs[Rs_color + idx] = color; + /* handle color aliases */ if (isdigit (*color)) { @@ -902,41 +907,24 @@ { /* bright colors */ i -= 8; pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; - SET_PIXCOLOR (idx); goto done; } if (i >= 0 && i <= 7) { /* normal colors */ pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; - SET_PIXCOLOR (idx); goto done; } } - if (!rXParseAllocColor (&xcol, color)) - return; - - /* XStoreColor (display->display, display->cmap, XColor*); */ + set_color (xcol, color); /* * FIXME: should free colors here, but no idea how to do it so instead, * so just keep gobbling up the colormap */ -# if 0 - for (i = Color_Black; i <= Color_White; i++) - if (pix_colors[idx] == pix_colors[i]) - break; - if (i > Color_White) - { - /* fprintf (stderr, "XFreeColors: pix_colors [%d] = %lu\n", idx, pix_colors [idx]); */ - XFreeColors (display->display, display->cmap, (pix_colors + idx), 1, - DisplayPlanes (display->display, display->screen)); - } -# endif pix_colors_focused[idx] = xcol; - SET_PIXCOLOR (idx); /* XSetWindowAttributes attr; */ /* Cursor cursor; */ @@ -944,7 +932,11 @@ #if OFF_FOCUS_FADING if (rs[Rs_fade]) - pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); + { + rgba c; + pix_colors [Color_fade].get (c); + pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); + } #endif /*TODO: handle Color_BD, scrollbar background, etc. */ @@ -969,8 +961,8 @@ ? pix_colors_focused[Color_pointer_bg] : pix_colors_focused[Color_bg]; - XQueryColors (display->display, cmap, xcol, 2); - XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); + XQueryColors (xdisp, cmap, xcol, 2); + XRecolorCursor (xdisp, TermWin_cursor, xcol + 0, xcol + 1); } /*----------------------------------------------------------------------*/ @@ -1008,16 +1000,14 @@ /*----------------------------------------------------------------------*/ -int -rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) +bool +rxvt_term::set_color (rxvt_color &color, const char *name) { - if (!screen_in_out->set (this, colour)) - { - rxvt_warn ("can't get colour '%s', continuing without.\n", colour); - return false; - } + if (color.set (this, name)) + return true; - return true; + rxvt_warn ("can't get colour '%s', continuing without.\n", name); + return false; } /* -------------------------------------------------------------------- * @@ -1127,7 +1117,7 @@ if (newwidth == 0 || newheight == 0) { - XGetWindowAttributes (display->display, display->root, &wattr); + XGetWindowAttributes (xdisp, display->root, &wattr); if (newwidth == 0) newwidth = wattr.width - szHint.base_width; @@ -1199,8 +1189,8 @@ if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ *p = '\0'; - atom = XInternAtom (display->display, server, False); - win = XGetSelectionOwner (display->display, atom); + atom = XInternAtom (xdisp, server, False); + win = XGetSelectionOwner (xdisp, atom); if (win != None) return True; @@ -1434,7 +1424,7 @@ fheight + 1, fheight - 1, fheight - 2, fheight + 2); - fs = XCreateFontSet (display->display, rs[Rs_imFont] ? rs[Rs_imFont] : pat, + fs = XCreateFontSet (xdisp, rs[Rs_imFont] ? rs[Rs_imFont] : pat, &missing_charset_list, &missing_charset_count, &def_string); if (missing_charset_list) @@ -1520,7 +1510,7 @@ if (preedit_attr) XFree (preedit_attr); if (status_attr) XFree (status_attr); - if (fs) XFreeFontSet (display->display, fs); + if (fs) XFreeFontSet (xdisp, fs); if (Input_Context == NULL) {