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.209 by root, Mon Jan 30 20:12:37 2006 UTC vs.
Revision 1.217 by root, Thu Feb 2 18:00:23 2006 UTC

252 delete drawable; 252 delete drawable;
253 // destroy all windows 253 // destroy all windows
254 if (parent[0]) 254 if (parent[0])
255 XDestroyWindow (xdisp, parent[0]); 255 XDestroyWindow (xdisp, parent[0]);
256 256
257 for (int i = 0; i < TOTAL_COLORS; i++)
258 if (ISSET_PIXCOLOR (i))
259 {
260 pix_colors_focused [i].free (this);
261#if OFF_FOCUS_FADING
262 pix_colors_unfocused [i].free (this);
263#endif
264 }
265
257 clear (); 266 clear ();
258 } 267 }
259 268
260 // TODO: free pixcolours, colours should become part of rxvt_display
261 delete pix_colors_focused; 269 delete pix_colors_focused;
262#if OFF_FOCUS_FADING 270#if OFF_FOCUS_FADING
263 delete pix_colors_unfocused; 271 delete pix_colors_unfocused;
264#endif 272#endif
265 273
691 699
692 if (scrollBar.state) 700 if (scrollBar.state)
693 { 701 {
694 sb_w = scrollbar_TotalWidth (); 702 sb_w = scrollbar_TotalWidth ();
695 szHint.base_width += sb_w; 703 szHint.base_width += sb_w;
704
696 if (!OPTION (Opt_scrollBar_right)) 705 if (!OPTION (Opt_scrollBar_right))
697 window_vt_x += sb_w; 706 window_vt_x += sb_w;
698 } 707 }
699 708
700 szHint.width_inc = fwidth; 709 szHint.width_inc = fwidth;
887void 896void
888rxvt_term::set_window_color (int idx, const char *color) 897rxvt_term::set_window_color (int idx, const char *color)
889{ 898{
890 rxvt_color xcol; 899 rxvt_color xcol;
891 int i; 900 int i;
892 901
893 if (color == NULL || *color == '\0') 902 if (color == NULL || *color == '\0')
894 return; 903 return;
904
905 color = strdup (color);
906 allocated.push_back ((void *)color);
907 rs[Rs_color + idx] = color;
895 908
896 /* handle color aliases */ 909 /* handle color aliases */
897 if (isdigit (*color)) 910 if (isdigit (*color))
898 { 911 {
899 i = atoi (color); 912 i = atoi (color);
900 913
901 if (i >= 8 && i <= 15) 914 if (i >= 8 && i <= 15)
902 { /* bright colors */ 915 { /* bright colors */
903 i -= 8; 916 i -= 8;
904 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; 917 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i];
905 SET_PIXCOLOR (idx);
906 goto done; 918 goto done;
907 } 919 }
908 920
909 if (i >= 0 && i <= 7) 921 if (i >= 0 && i <= 7)
910 { /* normal colors */ 922 { /* normal colors */
911 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; 923 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i];
912 SET_PIXCOLOR (idx);
913 goto done; 924 goto done;
914 } 925 }
915 } 926 }
916 927
917 if (!set_color (xcol, color)) 928 set_color (xcol, color);
918 return;
919
920 /* XStoreColor (xdisp, display->cmap, XColor*); */
921 929
922 /* 930 /*
923 * FIXME: should free colors here, but no idea how to do it so instead, 931 * FIXME: should free colors here, but no idea how to do it so instead,
924 * so just keep gobbling up the colormap 932 * so just keep gobbling up the colormap
925 */ 933 */
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 934
938 pix_colors_focused[idx] = xcol; 935 pix_colors_focused[idx] = xcol;
939 SET_PIXCOLOR (idx);
940 936
941 /* XSetWindowAttributes attr; */ 937 /* XSetWindowAttributes attr; */
942 /* Cursor cursor; */ 938 /* Cursor cursor; */
943done: 939done:
944 940
945#if OFF_FOCUS_FADING 941#if OFF_FOCUS_FADING
946 if (rs[Rs_fade]) 942 if (rs[Rs_fade])
947 pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); 943 {
944 rgba c;
945 pix_colors [Color_fade].get (c);
946 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
947 }
948#endif 948#endif
949 949
950 /*TODO: handle Color_BD, scrollbar background, etc. */ 950 /*TODO: handle Color_BD, scrollbar background, etc. */
951 951
952 recolour_cursor (); 952 recolour_cursor ();
958#endif /* XTERM_COLOR_CHANGE */ 958#endif /* XTERM_COLOR_CHANGE */
959 959
960void 960void
961rxvt_term::recolour_cursor () 961rxvt_term::recolour_cursor ()
962{ 962{
963 XColor xcol[2]; 963 XColor fg, bg;
964 964
965 xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) 965 (ISSET_PIXCOLOR (Color_pointer_fg)
966 ? pix_colors_focused[Color_pointer_fg] 966 ? pix_colors_focused[Color_pointer_fg]
967 : pix_colors_focused[Color_fg]; 967 : pix_colors_focused[Color_fg]).get (fg);
968
968 xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) 969 (ISSET_PIXCOLOR (Color_pointer_bg)
969 ? pix_colors_focused[Color_pointer_bg] 970 ? pix_colors_focused[Color_pointer_bg]
970 : pix_colors_focused[Color_bg]; 971 : pix_colors_focused[Color_bg]).get (bg);
971 972
972 XQueryColors (xdisp, cmap, xcol, 2);
973 XRecolorCursor (xdisp, TermWin_cursor, xcol + 0, xcol + 1); 973 XRecolorCursor (xdisp, TermWin_cursor, &fg, &bg);
974} 974}
975 975
976/*----------------------------------------------------------------------*/ 976/*----------------------------------------------------------------------*/
977/* 977/*
978 * find if fg/bg matches any of the normal (low-intensity) colors 978 * find if fg/bg matches any of the normal (low-intensity) colors
1014 if (color.set (this, name)) 1014 if (color.set (this, name))
1015 return true; 1015 return true;
1016 1016
1017 rxvt_warn ("can't get colour '%s', continuing without.\n", name); 1017 rxvt_warn ("can't get colour '%s', continuing without.\n", name);
1018 return false; 1018 return false;
1019}
1020
1021void
1022rxvt_term::alias_color (int dst, int src)
1023{
1024 pix_colors[dst].set (this, rs[Rs_color + dst] = rs[Rs_color + src]);
1019} 1025}
1020 1026
1021/* -------------------------------------------------------------------- * 1027/* -------------------------------------------------------------------- *
1022 * - WINDOW RESIZING - * 1028 * - WINDOW RESIZING - *
1023 * -------------------------------------------------------------------- */ 1029 * -------------------------------------------------------------------- */
1102 } 1108 }
1103 1109
1104 if (fix_screen || old_height == 0) 1110 if (fix_screen || old_height == 0)
1105 scr_reset (); 1111 scr_reset ();
1106 1112
1113 // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version
1114 //scr_touch (false);
1115
1107#ifdef XPM_BACKGROUND 1116#ifdef XPM_BACKGROUND
1108 if (pixmap) 1117 if (pixmap)
1109 scr_touch (false); 1118 scr_touch (false);
1110#endif 1119#endif
1111 1120
1147#ifdef USE_XIM 1156#ifdef USE_XIM
1148 1157
1149void 1158void
1150rxvt_term::im_set_color (unsigned long &fg, unsigned long &bg) 1159rxvt_term::im_set_color (unsigned long &fg, unsigned long &bg)
1151{ 1160{
1152 fg = pix_colors[Color_fg]; 1161 fg = pix_colors [Color_fg];
1153 bg = pix_colors[Color_bg]; 1162 bg = pix_colors [Color_bg];
1154} 1163}
1155 1164
1156void 1165void
1157rxvt_term::im_set_size (XRectangle &size) 1166rxvt_term::im_set_size (XRectangle &size)
1158{ 1167{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines