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

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.210 by root, Tue Jan 31 16:19:16 2006 UTC vs.
Revision 1.215 by root, Wed Feb 1 18:36:48 2006 UTC

691 691
692 if (scrollBar.state) 692 if (scrollBar.state)
693 { 693 {
694 sb_w = scrollbar_TotalWidth (); 694 sb_w = scrollbar_TotalWidth ();
695 szHint.base_width += sb_w; 695 szHint.base_width += sb_w;
696
696 if (!OPTION (Opt_scrollBar_right)) 697 if (!OPTION (Opt_scrollBar_right))
697 window_vt_x += sb_w; 698 window_vt_x += sb_w;
698 } 699 }
699 700
700 szHint.width_inc = fwidth; 701 szHint.width_inc = fwidth;
887void 888void
888rxvt_term::set_window_color (int idx, const char *color) 889rxvt_term::set_window_color (int idx, const char *color)
889{ 890{
890 rxvt_color xcol; 891 rxvt_color xcol;
891 int i; 892 int i;
892 893
893 if (color == NULL || *color == '\0') 894 if (color == NULL || *color == '\0')
894 return; 895 return;
896
897 color = strdup (color);
898 allocated.push_back ((void *)color);
899 rs[Rs_color + idx] = color;
895 900
896 /* handle color aliases */ 901 /* handle color aliases */
897 if (isdigit (*color)) 902 if (isdigit (*color))
898 { 903 {
899 i = atoi (color); 904 i = atoi (color);
900 905
901 if (i >= 8 && i <= 15) 906 if (i >= 8 && i <= 15)
902 { /* bright colors */ 907 { /* bright colors */
903 i -= 8; 908 i -= 8;
904 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; 909 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i];
905 SET_PIXCOLOR (idx);
906 goto done; 910 goto done;
907 } 911 }
908 912
909 if (i >= 0 && i <= 7) 913 if (i >= 0 && i <= 7)
910 { /* normal colors */ 914 { /* normal colors */
911 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; 915 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i];
912 SET_PIXCOLOR (idx);
913 goto done; 916 goto done;
914 } 917 }
915 } 918 }
916 919
917 if (!set_color (xcol, color)) 920 set_color (xcol, color);
918 return;
919
920 /* XStoreColor (xdisp, display->cmap, XColor*); */
921 921
922 /* 922 /*
923 * FIXME: should free colors here, but no idea how to do it so instead, 923 * FIXME: should free colors here, but no idea how to do it so instead,
924 * so just keep gobbling up the colormap 924 * so just keep gobbling up the colormap
925 */ 925 */
926# if 0
927 for (i = Color_Black; i <= Color_White; i++)
928 if (pix_colors[idx] == pix_colors[i])
929 break;
930 if (i > Color_White)
931 {
932 /* fprintf (stderr, "XFreeColors: pix_colors [%d] = %lu\n", idx, pix_colors [idx]); */
933 XFreeColors (xdisp, display->cmap, (pix_colors + idx), 1,
934 DisplayPlanes (xdisp, display->screen));
935 }
936# endif
937 926
938 pix_colors_focused[idx] = xcol; 927 pix_colors_focused[idx] = xcol;
939 SET_PIXCOLOR (idx);
940 928
941 /* XSetWindowAttributes attr; */ 929 /* XSetWindowAttributes attr; */
942 /* Cursor cursor; */ 930 /* Cursor cursor; */
943done: 931done:
944 932
945#if OFF_FOCUS_FADING 933#if OFF_FOCUS_FADING
946 if (rs[Rs_fade]) 934 if (rs[Rs_fade])
947 { 935 {
948 rxvt_rgba c; 936 rgba c;
949 pix_colors [Color_fade].get (this, c); 937 pix_colors [Color_fade].get (c);
950 pix_colors_unfocused [idx] = pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), c); 938 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
951 } 939 }
952#endif 940#endif
953 941
954 /*TODO: handle Color_BD, scrollbar background, etc. */ 942 /*TODO: handle Color_BD, scrollbar background, etc. */
955 943
962#endif /* XTERM_COLOR_CHANGE */ 950#endif /* XTERM_COLOR_CHANGE */
963 951
964void 952void
965rxvt_term::recolour_cursor () 953rxvt_term::recolour_cursor ()
966{ 954{
967 XColor xcol[2]; 955 XColor fg, bg;
968 956
969 xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) 957 (ISSET_PIXCOLOR (Color_pointer_fg)
970 ? pix_colors_focused[Color_pointer_fg] 958 ? pix_colors_focused[Color_pointer_fg]
971 : pix_colors_focused[Color_fg]; 959 : pix_colors_focused[Color_fg]).get (fg);
960
972 xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) 961 (ISSET_PIXCOLOR (Color_pointer_bg)
973 ? pix_colors_focused[Color_pointer_bg] 962 ? pix_colors_focused[Color_pointer_bg]
974 : pix_colors_focused[Color_bg]; 963 : pix_colors_focused[Color_bg]).get (bg);
975 964
976 XQueryColors (xdisp, cmap, xcol, 2);
977 XRecolorCursor (xdisp, TermWin_cursor, xcol + 0, xcol + 1); 965 XRecolorCursor (xdisp, TermWin_cursor, &fg, &bg);
978} 966}
979 967
980/*----------------------------------------------------------------------*/ 968/*----------------------------------------------------------------------*/
981/* 969/*
982 * find if fg/bg matches any of the normal (low-intensity) colors 970 * find if fg/bg matches any of the normal (low-intensity) colors

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines