… | |
… | |
324 | NULL, /* Color_RV */ |
324 | NULL, /* Color_RV */ |
325 | #endif /* ! NO_BOLD_UNDERLINE_REVERSE */ |
325 | #endif /* ! NO_BOLD_UNDERLINE_REVERSE */ |
326 | #ifdef OPTION_HC |
326 | #ifdef OPTION_HC |
327 | NULL, |
327 | NULL, |
328 | #endif |
328 | #endif |
329 | #if TINTING |
|
|
330 | NULL, |
|
|
331 | #endif |
|
|
332 | #ifdef KEEP_SCROLLCOLOR |
329 | #ifdef KEEP_SCROLLCOLOR |
333 | COLOR_SCROLLBAR, |
330 | COLOR_SCROLLBAR, |
334 | COLOR_SCROLLTROUGH, |
331 | COLOR_SCROLLTROUGH, |
335 | #endif /* KEEP_SCROLLCOLOR */ |
332 | #endif /* KEEP_SCROLLCOLOR */ |
336 | |
333 | #if TINTING |
|
|
334 | NULL, |
|
|
335 | #endif |
337 | }; |
336 | }; |
338 | |
337 | |
339 | const char *const xa_names[NUM_XA] = |
338 | const char *const xa_names[NUM_XA] = |
340 | { |
339 | { |
341 | "TEXT", |
340 | "TEXT", |
… | |
… | |
358 | }; |
357 | }; |
359 | |
358 | |
360 | bool |
359 | bool |
361 | rxvt_term::init_vars () |
360 | rxvt_term::init_vars () |
362 | { |
361 | { |
363 | 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 | |
364 | if (PixColors == NULL) |
368 | if (PixColors == NULL) |
365 | return false; |
369 | return false; |
366 | |
370 | |
367 | #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) |
371 | #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) |
368 | TermWin.pixmap = None; |
372 | TermWin.pixmap = None; |
… | |
… | |
753 | void |
757 | void |
754 | rxvt_term::set_locale (const char *locale) |
758 | rxvt_term::set_locale (const char *locale) |
755 | { |
759 | { |
756 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
760 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
757 | free (this->locale); |
761 | free (this->locale); |
758 | this->locale = rxvt_strdup (setlocale (LC_CTYPE, locale)); |
762 | this->locale = setlocale (LC_CTYPE, locale); |
|
|
763 | |
|
|
764 | if (!this->locale) |
|
|
765 | { |
|
|
766 | rxvt_warn ("unable to set locale \"%s\", using default locale instead.\n", locale); |
|
|
767 | setlocale (LC_CTYPE, ""); |
|
|
768 | this->locale = ""; |
|
|
769 | } |
|
|
770 | |
|
|
771 | this->locale = rxvt_strdup (this->locale); |
759 | SET_LOCALE (this->locale); |
772 | SET_LOCALE (this->locale); |
760 | mbstate.reset (); |
773 | mbstate.reset (); |
761 | #endif |
774 | #endif |
762 | #if 0 |
775 | #if 0 |
763 | #if HAVE_NL_LANGINFO |
776 | #if HAVE_NL_LANGINFO |
… | |
… | |
826 | meta_char = (Options & Opt_meta8 ? 0x80 : C0_ESC); |
839 | meta_char = (Options & Opt_meta8 ? 0x80 : C0_ESC); |
827 | #endif |
840 | #endif |
828 | |
841 | |
829 | get_ourmods (); |
842 | get_ourmods (); |
830 | |
843 | |
831 | if (! (Options & Opt_scrollTtyOutput)) |
844 | if (!(Options & Opt_scrollTtyOutput)) |
832 | PrivateModes |= PrivMode_TtyOutputInh; |
845 | PrivateModes |= PrivMode_TtyOutputInh; |
833 | if (Options & Opt_scrollTtyKeypress) |
846 | if (Options & Opt_scrollTtyKeypress) |
834 | PrivateModes |= PrivMode_Keypress; |
847 | PrivateModes |= PrivMode_Keypress; |
835 | if (! (Options & Opt_jumpScroll)) |
848 | if (!(Options & Opt_jumpScroll)) |
836 | PrivateModes |= PrivMode_smoothScroll; |
849 | PrivateModes |= PrivMode_smoothScroll; |
837 | |
850 | |
838 | #ifndef NO_BACKSPACE_KEY |
851 | #ifndef NO_BACKSPACE_KEY |
839 | if (STRCMP (key_backspace, "DEC") == 0) |
852 | if (STRCMP (key_backspace, "DEC") == 0) |
840 | PrivateModes |= PrivMode_HaveBackSpace; |
853 | PrivateModes |= PrivMode_HaveBackSpace; |
… | |
… | |
865 | void |
878 | void |
866 | rxvt_term::Get_Colours () |
879 | rxvt_term::Get_Colours () |
867 | { |
880 | { |
868 | int i; |
881 | int i; |
869 | |
882 | |
|
|
883 | #ifdef OFF_FOCUS_FADING |
|
|
884 | PixColors = PixColorsFocused; |
|
|
885 | #endif |
|
|
886 | |
870 | for (i = 0; i < (XDEPTH <= 2 ? 2 : NRS_COLORS); i++) |
887 | for (i = 0; i < (XDEPTH <= 2 ? 2 : NRS_COLORS); i++) |
871 | { |
888 | { |
872 | rxvt_color xcol; |
889 | rxvt_color xcol; |
873 | |
890 | |
874 | if (!rs[Rs_color + i]) |
891 | if (!rs[Rs_color + i]) |
… | |
… | |
910 | } |
927 | } |
911 | } |
928 | } |
912 | } |
929 | } |
913 | |
930 | |
914 | 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 |
915 | SET_PIXCOLOR (i); |
936 | SET_PIXCOLOR (i); |
916 | } |
937 | } |
917 | |
938 | |
918 | if (XDEPTH <= 2) |
939 | if (XDEPTH <= 2) |
919 | { |
940 | { |
… | |
… | |
930 | */ |
951 | */ |
931 | #ifdef KEEP_SCROLLCOLOR |
952 | #ifdef KEEP_SCROLLCOLOR |
932 | |
953 | |
933 | if (XDEPTH <= 2) |
954 | if (XDEPTH <= 2) |
934 | { /* Monochrome */ |
955 | { /* Monochrome */ |
935 | PixColors[Color_scroll] = PixColors[Color_fg]; |
956 | PixColors[Color_scroll] = PixColors[Color_fg]; |
936 | PixColors[Color_topShadow] = PixColors[Color_bg]; |
957 | PixColors[Color_topShadow] = PixColors[Color_bg]; |
937 | PixColors[Color_bottomShadow] = PixColors[Color_bg]; |
958 | PixColors[Color_bottomShadow] = PixColors[Color_bg]; |
938 | } |
959 | } |
939 | else |
960 | else |
940 | { |
961 | { |
941 | rxvt_color xcol[3]; |
962 | rxvt_color xcol[2]; |
942 | /* xcol[0] == white |
963 | /* xcol[0] == white |
943 | * xcol[1] == top shadow |
964 | * xcol[1] == top shadow |
944 | * xcol[2] == bot shadow */ |
965 | * xcol[2] == bot shadow */ |
945 | |
966 | |
946 | xcol[1] = PixColors[Color_scroll]; |
967 | xcol[1] = PixColors[Color_scroll]; |
947 | # ifdef PREFER_24BIT |
|
|
948 | xcol[0].set (display, 65535, 65535, 65535); |
968 | xcol[0].set (display, 65535, 65535, 65535); |
949 | /* XFreeColors (display->display, XCMAP, & (xcol[0].pixel), 1, ~0); */ |
|
|
950 | # else |
|
|
951 | xcol[0].set (display, WhitePixel (display->display, display->screen)); |
|
|
952 | # endif |
|
|
953 | |
969 | |
954 | unsigned short pr1, pg1, pb1, pr0, pg0, pb0; |
970 | unsigned short pr1, pg1, pb1, pr0, pg0, pb0; |
955 | |
971 | |
956 | xcol[0].get (display, pr0, pg0, pb0); |
972 | xcol[0].get (display, pr0, pg0, pb0); |
957 | xcol[1].get (display, pr1, pg1, pb1); |
973 | xcol[1].get (display, pr1, pg1, pb1); |
958 | |
974 | |
959 | /* bottomShadowColor */ |
|
|
960 | if (!xcol[2].set (display, pr1 / 2, pg1 / 2, pb1 / 2)) |
|
|
961 | xcol[2] = PixColors[Color_Black]; |
|
|
962 | |
|
|
963 | PixColors[Color_bottomShadow] = xcol[2]; |
975 | PixColors[Color_bottomShadow] = xcol[1].fade (display, 50); |
964 | |
976 | |
965 | /* topShadowColor */ |
977 | /* topShadowColor */ |
966 | if (!xcol[1].set (display, |
978 | if (!xcol[1].set (display, |
967 | min (pr0, max (pr0 / 5, pr1) * 7 / 5), |
979 | min (pr0, max (pr0 / 5, pr1) * 7 / 5), |
968 | min (pg0, max (pg0 / 5, pg1) * 7 / 5), |
980 | min (pg0, max (pg0 / 5, pg1) * 7 / 5), |
… | |
… | |
1143 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
1155 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
1144 | PropModeReplace, (unsigned char *)&pid, 1); |
1156 | PropModeReplace, (unsigned char *)&pid, 1); |
1145 | #endif |
1157 | #endif |
1146 | |
1158 | |
1147 | XSelectInput (display->display, TermWin.parent[0], |
1159 | XSelectInput (display->display, TermWin.parent[0], |
1148 | KeyPressMask |
1160 | KeyPressMask |
1149 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1161 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1150 | | KeyReleaseMask |
1162 | | KeyReleaseMask |
1151 | #endif |
1163 | #endif |
1152 | | FocusChangeMask | VisibilityChangeMask |
1164 | | FocusChangeMask | VisibilityChangeMask |
1153 | | StructureNotifyMask); |
1165 | | StructureNotifyMask); |
1154 | termwin_ev.start (display, TermWin.parent[0]); |
1166 | termwin_ev.start (display, TermWin.parent[0]); |
1155 | |
1167 | |
1156 | /* 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 */ |
1157 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1169 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1158 | |
1170 | |
… | |
… | |
1174 | } |
1186 | } |
1175 | #endif |
1187 | #endif |
1176 | |
1188 | |
1177 | /* the vt window */ |
1189 | /* the vt window */ |
1178 | TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1190 | TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1179 | window_vt_x, window_vt_y, |
1191 | window_vt_x, |
|
|
1192 | window_vt_y, |
1180 | TermWin_TotalWidth (), |
1193 | TermWin_TotalWidth (), |
1181 | TermWin_TotalHeight (), |
1194 | TermWin_TotalHeight (), |
1182 | 0, |
1195 | 0, |
1183 | PixColors[Color_fg], |
1196 | PixColors[Color_fg], |
1184 | PixColors[Color_bg]); |
1197 | PixColors[Color_bg]); |
1185 | |
|
|
1186 | #ifdef DEBUG_X |
1198 | #ifdef DEBUG_X |
1187 | XStoreName (display->display, TermWin.vt, "vt window"); |
1199 | XStoreName (display->display, TermWin.vt, "vt window"); |
1188 | #endif |
1200 | #endif |
1189 | |
1201 | |
1190 | attributes.bit_gravity = NorthWestGravity; |
1202 | attributes.bit_gravity = NorthWestGravity; |
1191 | XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes); |
1203 | XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes); |
1192 | |
1204 | |
1193 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1205 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1194 | |
1206 | |
|
|
1207 | pointer_unblank (); |
|
|
1208 | |
1195 | #ifdef POINTER_BLANK |
1209 | #ifdef POINTER_BLANK |
1196 | pointer_unblank (); |
|
|
1197 | |
|
|
1198 | if (Options & Opt_pointerBlank) |
1210 | if (Options & Opt_pointerBlank) |
1199 | vt_emask |= PointerMotionMask; |
1211 | vt_emask |= PointerMotionMask; |
1200 | else |
1212 | else |
1201 | #endif |
1213 | #endif |
1202 | vt_emask |= Button1MotionMask | Button3MotionMask; |
1214 | vt_emask |= Button1MotionMask | Button3MotionMask; |
… | |
… | |
1233 | |
1245 | |
1234 | #ifdef XPM_BACKGROUND |
1246 | #ifdef XPM_BACKGROUND |
1235 | if (rs[Rs_backgroundPixmap] != NULL |
1247 | if (rs[Rs_backgroundPixmap] != NULL |
1236 | && ! (Options & Opt_transparent)) |
1248 | && ! (Options & Opt_transparent)) |
1237 | { |
1249 | { |
1238 | const char *p = rs[Rs_backgroundPixmap]; |
1250 | const char *p = rs[Rs_backgroundPixmap]; |
1239 | |
1251 | |
1240 | if ((p = STRCHR (p, ';')) != NULL) |
1252 | if ((p = STRCHR (p, ';')) != NULL) |
1241 | { |
1253 | { |
1242 | p++; |
1254 | p++; |
1243 | scale_pixmap (p); |
1255 | scale_pixmap (p); |
… | |
… | |
1262 | topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1274 | topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1263 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1275 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1264 | botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1276 | botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1265 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; |
1277 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; |
1266 | 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; |
1267 | #endif |
1285 | #endif |
1268 | } |
1286 | } |
1269 | |
1287 | |
1270 | /*----------------------------------------------------------------------*/ |
1288 | /*----------------------------------------------------------------------*/ |
1271 | /* |
1289 | /* |