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

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.57 by root, Mon Jun 21 22:24:07 2004 UTC vs.
Revision 1.65 by root, Fri Jul 30 16:13:46 2004 UTC

357 }; 357 };
358 358
359bool 359bool
360rxvt_term::init_vars () 360rxvt_term::init_vars ()
361{ 361{
362 PixColors = new rxvt_color [TOTAL_COLORS]; 362 PixColorsFocused = new rxvt_color [TOTAL_COLORS];
363#ifdef OFF_FOCUS_FADING
364 PixColorsUnFocused = new rxvt_color [TOTAL_COLORS];
365#endif
366 PixColors = PixColorsFocused;
367
363 if (PixColors == NULL) 368 if (PixColors == NULL)
364 return false; 369 return false;
365 370
366#if defined(XPM_BACKGROUND) || defined(TRANSPARENT) 371#if defined(XPM_BACKGROUND) || defined(TRANSPARENT)
367 TermWin.pixmap = None; 372 TermWin.pixmap = None;
873void 878void
874rxvt_term::Get_Colours () 879rxvt_term::Get_Colours ()
875{ 880{
876 int i; 881 int i;
877 882
883#ifdef OFF_FOCUS_FADING
884 PixColors = PixColorsFocused;
885#endif
886
878 for (i = 0; i < (XDEPTH <= 2 ? 2 : NRS_COLORS); i++) 887 for (i = 0; i < (XDEPTH <= 2 ? 2 : NRS_COLORS); i++)
879 { 888 {
880 rxvt_color xcol; 889 rxvt_color xcol;
881 890
882 if (!rs[Rs_color + i]) 891 if (!rs[Rs_color + i])
918 } 927 }
919 } 928 }
920 } 929 }
921 930
922 PixColors[i] = xcol; 931 PixColors[i] = xcol;
932#ifdef OFF_FOCUS_FADING
933 if (rs[Rs_fade])
934 PixColorsUnFocused[i] = xcol.fade (display, atoi (rs[Rs_fade]));
935#endif
923 SET_PIXCOLOR (i); 936 SET_PIXCOLOR (i);
924 } 937 }
925 938
926 if (XDEPTH <= 2) 939 if (XDEPTH <= 2)
927 { 940 {
944 PixColors[Color_topShadow] = PixColors[Color_bg]; 957 PixColors[Color_topShadow] = PixColors[Color_bg];
945 PixColors[Color_bottomShadow] = PixColors[Color_bg]; 958 PixColors[Color_bottomShadow] = PixColors[Color_bg];
946 } 959 }
947 else 960 else
948 { 961 {
949 rxvt_color xcol[3]; 962 rxvt_color xcol[2];
950 /* xcol[0] == white 963 /* xcol[0] == white
951 * xcol[1] == top shadow 964 * xcol[1] == top shadow
952 * xcol[2] == bot shadow */ 965 * xcol[2] == bot shadow */
953 966
954 xcol[1] = PixColors[Color_scroll]; 967 xcol[1] = PixColors[Color_scroll];
955# ifdef PREFER_24BIT
956 xcol[0].set (display, 65535, 65535, 65535); 968 xcol[0].set (display, 65535, 65535, 65535);
957 /* XFreeColors (display->display, XCMAP, & (xcol[0].pixel), 1, ~0); */
958# else
959 xcol[0].set (display, WhitePixel (display->display, display->screen));
960# endif
961 969
962 unsigned short pr1, pg1, pb1, pr0, pg0, pb0; 970 unsigned short pr1, pg1, pb1, pr0, pg0, pb0;
963 971
964 xcol[0].get (display, pr0, pg0, pb0); 972 xcol[0].get (display, pr0, pg0, pb0);
965 xcol[1].get (display, pr1, pg1, pb1); 973 xcol[1].get (display, pr1, pg1, pb1);
966 974
967 /* bottomShadowColor */
968 if (!xcol[2].set (display, pr1 / 2, pg1 / 2, pb1 / 2))
969 xcol[2] = PixColors[Color_Black];
970
971 PixColors[Color_bottomShadow] = xcol[2]; 975 PixColors[Color_bottomShadow] = xcol[1].fade (display, 50);
972 976
973 /* topShadowColor */ 977 /* topShadowColor */
974 if (!xcol[1].set (display, 978 if (!xcol[1].set (display,
975 min (pr0, max (pr0 / 5, pr1) * 7 / 5), 979 min (pr0, max (pr0 / 5, pr1) * 7 / 5),
976 min (pg0, max (pg0 / 5, pg1) * 7 / 5), 980 min (pg0, max (pg0 / 5, pg1) * 7 / 5),
1151 display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, 1155 display->atom ("_NET_WM_PID"), XA_CARDINAL, 32,
1152 PropModeReplace, (unsigned char *)&pid, 1); 1156 PropModeReplace, (unsigned char *)&pid, 1);
1153#endif 1157#endif
1154 1158
1155 XSelectInput (display->display, TermWin.parent[0], 1159 XSelectInput (display->display, TermWin.parent[0],
1156 KeyPressMask 1160 KeyPressMask
1157#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1161#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1158 | KeyReleaseMask 1162 | KeyReleaseMask
1159#endif 1163#endif
1160 | FocusChangeMask | VisibilityChangeMask 1164 | FocusChangeMask | VisibilityChangeMask
1161 | StructureNotifyMask); 1165 | StructureNotifyMask);
1162 termwin_ev.start (display, TermWin.parent[0]); 1166 termwin_ev.start (display, TermWin.parent[0]);
1163 1167
1164 /* vt cursor: Black-on-White is standard, but this is more popular */ 1168 /* vt cursor: Black-on-White is standard, but this is more popular */
1165 TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); 1169 TermWin_cursor = XCreateFontCursor (display->display, XC_xterm);
1166 1170
1189 TermWin_TotalWidth (), 1193 TermWin_TotalWidth (),
1190 TermWin_TotalHeight (), 1194 TermWin_TotalHeight (),
1191 0, 1195 0,
1192 PixColors[Color_fg], 1196 PixColors[Color_fg],
1193 PixColors[Color_bg]); 1197 PixColors[Color_bg]);
1194
1195#ifdef DEBUG_X 1198#ifdef DEBUG_X
1196 XStoreName (display->display, TermWin.vt, "vt window"); 1199 XStoreName (display->display, TermWin.vt, "vt window");
1197#endif 1200#endif
1198 1201
1199 attributes.bit_gravity = NorthWestGravity; 1202 attributes.bit_gravity = NorthWestGravity;
1200 XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes); 1203 XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes);
1201 1204
1202 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; 1205 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
1203 1206
1207 pointer_unblank ();
1208
1204#ifdef POINTER_BLANK 1209#ifdef POINTER_BLANK
1205 pointer_unblank ();
1206
1207 if (Options & Opt_pointerBlank) 1210 if (Options & Opt_pointerBlank)
1208 vt_emask |= PointerMotionMask; 1211 vt_emask |= PointerMotionMask;
1209 else 1212 else
1210#endif 1213#endif
1211 vt_emask |= Button1MotionMask | Button3MotionMask; 1214 vt_emask |= Button1MotionMask | Button3MotionMask;
1242 1245
1243#ifdef XPM_BACKGROUND 1246#ifdef XPM_BACKGROUND
1244 if (rs[Rs_backgroundPixmap] != NULL 1247 if (rs[Rs_backgroundPixmap] != NULL
1245 && ! (Options & Opt_transparent)) 1248 && ! (Options & Opt_transparent))
1246 { 1249 {
1247 const char *p = rs[Rs_backgroundPixmap]; 1250 const char *p = rs[Rs_backgroundPixmap];
1248 1251
1249 if ((p = STRCHR (p, ';')) != NULL) 1252 if ((p = STRCHR (p, ';')) != NULL)
1250 { 1253 {
1251 p++; 1254 p++;
1252 scale_pixmap (p); 1255 scale_pixmap (p);
1271 topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); 1274 topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
1272 gcvalue.foreground = PixColors[Color_bottomShadow]; 1275 gcvalue.foreground = PixColors[Color_bottomShadow];
1273 botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); 1276 botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
1274 gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; 1277 gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)];
1275 scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); 1278 scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
1279#endif
1280
1281#ifdef OFF_FOCUS_FADING
1282 // initially we are in unfocused state
1283 if (rs[Rs_fade])
1284 PixColors = PixColorsUnFocused;
1276#endif 1285#endif
1277} 1286}
1278 1287
1279/*----------------------------------------------------------------------*/ 1288/*----------------------------------------------------------------------*/
1280/* 1289/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines