1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: init.c |
2 | * File: init.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
7 | * - original version |
7 | * - original version |
… | |
… | |
313 | #endif |
313 | #endif |
314 | #ifndef NO_CURSORCOLOR |
314 | #ifndef NO_CURSORCOLOR |
315 | COLOR_CURSOR_BACKGROUND, |
315 | COLOR_CURSOR_BACKGROUND, |
316 | COLOR_CURSOR_FOREGROUND, |
316 | COLOR_CURSOR_FOREGROUND, |
317 | #endif /* ! NO_CURSORCOLOR */ |
317 | #endif /* ! NO_CURSORCOLOR */ |
318 | NULL, /* Color_pointer */ |
318 | NULL, /* Color_pointer_fg */ |
|
|
319 | NULL, /* Color_pointer_bg */ |
319 | NULL, /* Color_border */ |
320 | NULL, /* Color_border */ |
320 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
321 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
321 | NULL, /* Color_BD */ |
322 | NULL, /* Color_BD */ |
322 | NULL, /* Color_UL */ |
323 | NULL, /* Color_UL */ |
323 | NULL, /* Color_RV */ |
324 | NULL, /* Color_RV */ |
… | |
… | |
327 | #endif |
328 | #endif |
328 | #ifdef KEEP_SCROLLCOLOR |
329 | #ifdef KEEP_SCROLLCOLOR |
329 | COLOR_SCROLLBAR, |
330 | COLOR_SCROLLBAR, |
330 | COLOR_SCROLLTROUGH, |
331 | COLOR_SCROLLTROUGH, |
331 | #endif /* KEEP_SCROLLCOLOR */ |
332 | #endif /* KEEP_SCROLLCOLOR */ |
332 | |
333 | #if TINTING |
|
|
334 | NULL, |
|
|
335 | #endif |
333 | }; |
336 | }; |
334 | |
337 | |
335 | const char *const xa_names[NUM_XA] = |
338 | const char *const xa_names[NUM_XA] = |
336 | { |
339 | { |
337 | "TEXT", |
340 | "TEXT", |
… | |
… | |
354 | }; |
357 | }; |
355 | |
358 | |
356 | bool |
359 | bool |
357 | rxvt_term::init_vars () |
360 | rxvt_term::init_vars () |
358 | { |
361 | { |
359 | 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 | |
360 | if (PixColors == NULL) |
368 | if (PixColors == NULL) |
361 | return false; |
369 | return false; |
362 | |
370 | |
363 | #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) |
371 | #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) |
364 | TermWin.pixmap = None; |
372 | TermWin.pixmap = None; |
… | |
… | |
644 | color_aliases (Color_bg); |
652 | color_aliases (Color_bg); |
645 | #ifndef NO_CURSORCOLOR |
653 | #ifndef NO_CURSORCOLOR |
646 | color_aliases (Color_cursor); |
654 | color_aliases (Color_cursor); |
647 | color_aliases (Color_cursor2); |
655 | color_aliases (Color_cursor2); |
648 | #endif /* NO_CURSORCOLOR */ |
656 | #endif /* NO_CURSORCOLOR */ |
649 | color_aliases (Color_pointer); |
657 | color_aliases (Color_pointer_fg); |
|
|
658 | color_aliases (Color_pointer_bg); |
650 | color_aliases (Color_border); |
659 | color_aliases (Color_border); |
651 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
660 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
652 | color_aliases (Color_BD); |
661 | color_aliases (Color_BD); |
653 | color_aliases (Color_UL); |
662 | color_aliases (Color_UL); |
654 | color_aliases (Color_RV); |
663 | color_aliases (Color_RV); |
… | |
… | |
748 | void |
757 | void |
749 | rxvt_term::set_locale (const char *locale) |
758 | rxvt_term::set_locale (const char *locale) |
750 | { |
759 | { |
751 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
760 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
752 | free (this->locale); |
761 | free (this->locale); |
753 | 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); |
754 | SET_LOCALE (this->locale); |
772 | SET_LOCALE (this->locale); |
755 | mbstate.reset (); |
773 | mbstate.reset (); |
756 | #endif |
774 | #endif |
757 | #if 0 |
775 | #if 0 |
758 | #if HAVE_NL_LANGINFO |
776 | #if HAVE_NL_LANGINFO |
… | |
… | |
821 | meta_char = (Options & Opt_meta8 ? 0x80 : C0_ESC); |
839 | meta_char = (Options & Opt_meta8 ? 0x80 : C0_ESC); |
822 | #endif |
840 | #endif |
823 | |
841 | |
824 | get_ourmods (); |
842 | get_ourmods (); |
825 | |
843 | |
826 | if (! (Options & Opt_scrollTtyOutput)) |
844 | if (!(Options & Opt_scrollTtyOutput)) |
827 | PrivateModes |= PrivMode_TtyOutputInh; |
845 | PrivateModes |= PrivMode_TtyOutputInh; |
828 | if (Options & Opt_scrollTtyKeypress) |
846 | if (Options & Opt_scrollTtyKeypress) |
829 | PrivateModes |= PrivMode_Keypress; |
847 | PrivateModes |= PrivMode_Keypress; |
830 | if (! (Options & Opt_jumpScroll)) |
848 | if (!(Options & Opt_jumpScroll)) |
831 | PrivateModes |= PrivMode_smoothScroll; |
849 | PrivateModes |= PrivMode_smoothScroll; |
832 | |
850 | |
833 | #ifndef NO_BACKSPACE_KEY |
851 | #ifndef NO_BACKSPACE_KEY |
834 | if (STRCMP (key_backspace, "DEC") == 0) |
852 | if (STRCMP (key_backspace, "DEC") == 0) |
835 | PrivateModes |= PrivMode_HaveBackSpace; |
853 | PrivateModes |= PrivMode_HaveBackSpace; |
… | |
… | |
860 | void |
878 | void |
861 | rxvt_term::Get_Colours () |
879 | rxvt_term::Get_Colours () |
862 | { |
880 | { |
863 | int i; |
881 | int i; |
864 | |
882 | |
|
|
883 | #ifdef OFF_FOCUS_FADING |
|
|
884 | PixColors = PixColorsFocused; |
|
|
885 | #endif |
|
|
886 | |
865 | for (i = 0; i < (XDEPTH <= 2 ? 2 : NRS_COLORS); i++) |
887 | for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) |
866 | { |
888 | { |
867 | rxvt_color xcol; |
889 | rxvt_color xcol; |
868 | |
890 | |
869 | if (!rs[Rs_color + i]) |
891 | if (!rs[Rs_color + i]) |
870 | continue; |
892 | continue; |
… | |
… | |
894 | #ifndef NO_CURSORCOLOR |
916 | #ifndef NO_CURSORCOLOR |
895 | case Color_cursor2: |
917 | case Color_cursor2: |
896 | xcol = PixColors[Color_fg]; |
918 | xcol = PixColors[Color_fg]; |
897 | break; |
919 | break; |
898 | #endif /* ! NO_CURSORCOLOR */ |
920 | #endif /* ! NO_CURSORCOLOR */ |
899 | case Color_pointer: |
921 | case Color_pointer_fg: |
900 | xcol = PixColors[Color_fg]; |
922 | xcol = PixColors[Color_fg]; |
901 | break; |
923 | break; |
902 | default: |
924 | default: |
903 | xcol = PixColors[Color_bg]; /* None */ |
925 | xcol = PixColors[Color_bg]; /* None */ |
904 | break; |
926 | break; |
905 | } |
927 | } |
906 | } |
928 | } |
907 | } |
929 | } |
908 | |
930 | |
909 | 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 |
910 | SET_PIXCOLOR (i); |
936 | SET_PIXCOLOR (i); |
911 | } |
937 | } |
912 | |
938 | |
913 | if (XDEPTH <= 2 || !rs[Rs_color + Color_pointer]) |
939 | if (display->depth <= 2) |
914 | PixColors[Color_pointer] = PixColors[Color_fg]; |
940 | { |
915 | if (XDEPTH <= 2 || !rs[Rs_color + Color_border]) |
941 | if (!rs[Rs_color + Color_pointer_fg]) PixColors[Color_pointer_fg] = PixColors[Color_fg]; |
916 | PixColors[Color_border] = PixColors[Color_fg]; |
942 | if (!rs[Rs_color + Color_pointer_bg]) PixColors[Color_pointer_bg] = PixColors[Color_bg]; |
|
|
943 | if (!rs[Rs_color + Color_border] ) PixColors[Color_border] = PixColors[Color_fg]; |
|
|
944 | } |
917 | |
945 | |
918 | /* |
946 | /* |
919 | * get scrollBar/menuBar shadow colors |
947 | * get scrollBar/menuBar shadow colors |
920 | * |
948 | * |
921 | * The calculations of topShadow/bottomShadow values are adapted |
949 | * The calculations of topShadow/bottomShadow values are adapted |
922 | * from the fvwm window manager. |
950 | * from the fvwm window manager. |
923 | */ |
951 | */ |
924 | #ifdef KEEP_SCROLLCOLOR |
952 | #ifdef KEEP_SCROLLCOLOR |
925 | |
953 | |
926 | if (XDEPTH <= 2) |
954 | if (display->depth <= 2) |
927 | { /* Monochrome */ |
955 | { /* Monochrome */ |
928 | PixColors[Color_scroll] = PixColors[Color_fg]; |
956 | PixColors[Color_scroll] = PixColors[Color_fg]; |
929 | PixColors[Color_topShadow] = PixColors[Color_bg]; |
957 | PixColors[Color_topShadow] = PixColors[Color_bg]; |
930 | PixColors[Color_bottomShadow] = PixColors[Color_bg]; |
958 | PixColors[Color_bottomShadow] = PixColors[Color_bg]; |
931 | } |
959 | } |
932 | else |
960 | else |
933 | { |
961 | { |
934 | rxvt_color xcol[3]; |
962 | rxvt_color xcol[2]; |
935 | /* xcol[0] == white |
963 | /* xcol[0] == white |
936 | * xcol[1] == top shadow |
964 | * xcol[1] == top shadow |
937 | * xcol[2] == bot shadow */ |
965 | * xcol[2] == bot shadow */ |
938 | |
966 | |
939 | xcol[1] = PixColors[Color_scroll]; |
967 | xcol[1] = PixColors[Color_scroll]; |
940 | # ifdef PREFER_24BIT |
|
|
941 | xcol[0].set (display, 65535, 65535, 65535); |
968 | xcol[0].set (display, 65535, 65535, 65535); |
942 | /* XFreeColors (display->display, XCMAP, & (xcol[0].pixel), 1, ~0); */ |
|
|
943 | # else |
|
|
944 | xcol[0].set (display, WhitePixel (display->display, display->screen)); |
|
|
945 | # endif |
|
|
946 | |
969 | |
947 | unsigned short pr1, pg1, pb1, pr0, pg0, pb0; |
970 | unsigned short pr1, pg1, pb1, pr0, pg0, pb0; |
948 | |
971 | |
949 | xcol[0].get (display, pr0, pg0, pb0); |
972 | xcol[0].get (display, pr0, pg0, pb0); |
950 | xcol[1].get (display, pr1, pg1, pb1); |
973 | xcol[1].get (display, pr1, pg1, pb1); |
951 | |
974 | |
952 | /* bottomShadowColor */ |
|
|
953 | if (!xcol[2].set (display, pr1 / 2, pg1 / 2, pb1 / 2)) |
|
|
954 | xcol[2] = PixColors[Color_Black]; |
|
|
955 | |
|
|
956 | PixColors[Color_bottomShadow] = xcol[2]; |
975 | PixColors[Color_bottomShadow] = xcol[1].fade (display, 50); |
957 | |
976 | |
958 | /* topShadowColor */ |
977 | /* topShadowColor */ |
959 | if (!xcol[1].set (display, |
978 | if (!xcol[1].set (display, |
960 | min (pr0, max (pr0 / 5, pr1) * 7 / 5), |
979 | min (pr0, max (pr0 / 5, pr1) * 7 / 5), |
961 | min (pg0, max (pg0 / 5, pg1) * 7 / 5), |
980 | min (pg0, max (pg0 / 5, pg1) * 7 / 5), |
… | |
… | |
1065 | /*----------------------------------------------------------------------*/ |
1084 | /*----------------------------------------------------------------------*/ |
1066 | /* rxvt_Create_Windows () - Open and map the window */ |
1085 | /* rxvt_Create_Windows () - Open and map the window */ |
1067 | void |
1086 | void |
1068 | rxvt_term::create_windows (int argc, const char *const *argv) |
1087 | rxvt_term::create_windows (int argc, const char *const *argv) |
1069 | { |
1088 | { |
1070 | XClassHint classHint; |
1089 | XClassHint classHint; |
1071 | XWMHints wmHint; |
1090 | XWMHints wmHint; |
|
|
1091 | #ifndef NO_FRILLS |
|
|
1092 | Atom prop = None; |
|
|
1093 | MWMHints mwmhints; |
|
|
1094 | #endif |
1072 | XGCValues gcvalue; |
1095 | XGCValues gcvalue; |
1073 | long vt_emask; |
1096 | long vt_emask; |
1074 | |
1097 | XSetWindowAttributes attributes; |
1075 | XWindowAttributes gattr; |
1098 | XWindowAttributes gattr; |
1076 | |
1099 | |
1077 | if (Options & Opt_transparent) |
1100 | if (Options & Opt_transparent) |
1078 | { |
1101 | { |
1079 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
1102 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
1080 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
1103 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
1081 | } |
1104 | } |
|
|
1105 | |
|
|
1106 | #ifndef NO_FRILLS |
|
|
1107 | if (Options & Opt_borderLess) |
|
|
1108 | { |
|
|
1109 | prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True); |
|
|
1110 | if (prop == None) |
|
|
1111 | { |
|
|
1112 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
|
|
1113 | #ifdef PREFER_24BIT |
|
|
1114 | attributes.override_redirect = TRUE; |
|
|
1115 | #endif |
|
|
1116 | mwmhints.flags = 0; |
|
|
1117 | } |
|
|
1118 | else |
|
|
1119 | { |
|
|
1120 | mwmhints.flags = MWM_HINTS_DECORATIONS; |
|
|
1121 | mwmhints.decorations = 0; |
|
|
1122 | } |
|
|
1123 | } |
|
|
1124 | else |
|
|
1125 | { |
|
|
1126 | mwmhints.flags = 0; |
|
|
1127 | } |
|
|
1128 | #endif |
1082 | |
1129 | |
1083 | /* grab colors before netscape does */ |
1130 | /* grab colors before netscape does */ |
1084 | Get_Colours (); |
1131 | Get_Colours (); |
1085 | |
1132 | |
1086 | if (!change_font (rs[Rs_font])) |
1133 | if (!change_font (rs[Rs_font])) |
… | |
… | |
1092 | |
1139 | |
1093 | window_calc (0, 0); |
1140 | window_calc (0, 0); |
1094 | old_width = szHint.width; |
1141 | old_width = szHint.width; |
1095 | old_height = szHint.height; |
1142 | old_height = szHint.height; |
1096 | |
1143 | |
1097 | /* parent window - reverse video so we can see placement errors |
|
|
1098 | * sub-window placement & size in rxvt_resize_subwindows () |
1144 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
1099 | */ |
|
|
1100 | |
1145 | |
1101 | #ifdef PREFER_24BIT |
1146 | #ifdef PREFER_24BIT |
1102 | XSetWindowAttributes attributes; |
|
|
1103 | |
|
|
1104 | attributes.background_pixel = PixColors[Color_fg]; |
1147 | attributes.background_pixel = PixColors[Color_bg]; |
1105 | attributes.border_pixel = PixColors[Color_border]; |
1148 | attributes.border_pixel = PixColors[Color_border]; |
1106 | attributes.colormap = display->cmap; |
1149 | attributes.colormap = display->cmap; |
1107 | TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display), |
1150 | TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display), |
1108 | szHint.x, szHint.y, |
1151 | szHint.x, szHint.y, |
1109 | szHint.width, szHint.height, |
1152 | szHint.width, szHint.height, |
1110 | TermWin.ext_bwidth, |
1153 | TermWin.ext_bwidth, |
1111 | display->depth, InputOutput, |
1154 | display->depth, InputOutput, |
1112 | display->visual, |
1155 | display->visual, |
1113 | CWBackPixel | CWBorderPixel | CWColormap, &attributes); |
1156 | CWColormap | CWBackPixel | CWBorderPixel, &attributes); |
1114 | #else |
1157 | #else |
1115 | TermWin.parent[0] = XCreateSimpleWindow (display->display, DefaultRootWindow (display->display), |
1158 | TermWin.parent[0] = XCreateSimpleWindow (display->display, DefaultRootWindow (display->display), |
1116 | szHint.x, szHint.y, |
1159 | szHint.x, szHint.y, |
1117 | szHint.width, |
1160 | szHint.width, szHint.height, |
1118 | szHint.height, |
|
|
1119 | TermWin.ext_bwidth, |
1161 | TermWin.ext_bwidth, |
1120 | PixColors[Color_border], |
1162 | PixColors[Color_border], |
1121 | PixColors[Color_fg]); |
1163 | PixColors[Color_bg]); |
1122 | #endif |
1164 | #endif |
1123 | |
1165 | |
1124 | xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); |
1166 | process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); |
1125 | xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); |
1167 | process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); |
1126 | |
1168 | |
1127 | classHint.res_name = (char *)rs[Rs_name]; |
1169 | classHint.res_name = (char *)rs[Rs_name]; |
1128 | classHint.res_class = (char *)RESCLASS; |
1170 | classHint.res_class = (char *)RESCLASS; |
1129 | |
1171 | |
1130 | wmHint.flags = (InputHint | StateHint | WindowGroupHint); |
1172 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
1131 | wmHint.input = True; |
1173 | wmHint.input = True; |
1132 | wmHint.initial_state = (Options & Opt_iconic ? IconicState |
1174 | wmHint.initial_state = Options & Opt_iconic ? IconicState : NormalState; |
1133 | : NormalState); |
|
|
1134 | wmHint.window_group = TermWin.parent[0]; |
1175 | wmHint.window_group = TermWin.parent[0]; |
1135 | |
1176 | |
1136 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
1177 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
1137 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
1178 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
|
|
1179 | |
|
|
1180 | #ifndef NO_FRILLS |
|
|
1181 | long pid = getpid (); |
|
|
1182 | XChangeProperty (display->display, TermWin.parent[0], |
|
|
1183 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
|
|
1184 | PropModeReplace, (unsigned char *)&pid, 1); |
|
|
1185 | #endif |
1138 | |
1186 | |
1139 | XSelectInput (display->display, TermWin.parent[0], |
1187 | XSelectInput (display->display, TermWin.parent[0], |
1140 | KeyPressMask |
1188 | KeyPressMask |
1141 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1189 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1142 | | KeyReleaseMask |
1190 | | KeyReleaseMask |
1143 | #endif |
1191 | #endif |
1144 | | FocusChangeMask | VisibilityChangeMask |
1192 | | FocusChangeMask | VisibilityChangeMask |
|
|
1193 | | ExposureMask |
1145 | | StructureNotifyMask); |
1194 | | StructureNotifyMask); |
1146 | termwin_ev.start (display, TermWin.parent[0]); |
1195 | termwin_ev.start (display, TermWin.parent[0]); |
|
|
1196 | |
|
|
1197 | #ifndef NO_FRILLS |
|
|
1198 | if (mwmhints.flags) |
|
|
1199 | { |
|
|
1200 | prop = XInternAtom(display->display, "_MOTIF_WM_HINTS", False); |
|
|
1201 | XChangeProperty(display->display, TermWin.parent[0], prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS); |
|
|
1202 | } |
|
|
1203 | #endif |
1147 | |
1204 | |
1148 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1205 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1149 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1206 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1150 | |
1207 | |
1151 | #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) |
1208 | #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) |
… | |
… | |
1166 | } |
1223 | } |
1167 | #endif |
1224 | #endif |
1168 | |
1225 | |
1169 | /* the vt window */ |
1226 | /* the vt window */ |
1170 | TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1227 | TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1171 | window_vt_x, window_vt_y, |
1228 | window_vt_x, |
|
|
1229 | window_vt_y, |
1172 | TermWin_TotalWidth (), |
1230 | TermWin_TotalWidth (), |
1173 | TermWin_TotalHeight (), |
1231 | TermWin_TotalHeight (), |
1174 | 0, |
1232 | 0, |
1175 | PixColors[Color_fg], |
1233 | PixColors[Color_fg], |
1176 | PixColors[Color_bg]); |
1234 | PixColors[Color_bg]); |
1177 | |
|
|
1178 | #ifdef DEBUG_X |
1235 | #ifdef DEBUG_X |
1179 | XStoreName (display->display, TermWin.vt, "vt window"); |
1236 | XStoreName (display->display, TermWin.vt, "vt window"); |
1180 | #endif |
1237 | #endif |
1181 | |
1238 | |
|
|
1239 | attributes.bit_gravity = NorthWestGravity; |
|
|
1240 | XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes); |
|
|
1241 | |
1182 | vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1242 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1183 | | PropertyChangeMask); |
1243 | |
|
|
1244 | pointer_unblank (); |
1184 | |
1245 | |
1185 | #ifdef POINTER_BLANK |
1246 | #ifdef POINTER_BLANK |
1186 | pointer_unblank (); |
|
|
1187 | |
|
|
1188 | if ((Options & Opt_pointerBlank)) |
1247 | if (Options & Opt_pointerBlank) |
1189 | vt_emask |= PointerMotionMask; |
1248 | vt_emask |= PointerMotionMask; |
1190 | else |
1249 | else |
1191 | #endif |
1250 | #endif |
1192 | vt_emask |= (Button1MotionMask | Button3MotionMask); |
1251 | vt_emask |= Button1MotionMask | Button3MotionMask; |
1193 | |
1252 | |
1194 | XSelectInput (display->display, TermWin.vt, vt_emask); |
1253 | XSelectInput (display->display, TermWin.vt, vt_emask); |
1195 | vt_ev.start (display, TermWin.vt); |
1254 | vt_ev.start (display, TermWin.vt); |
1196 | |
1255 | |
1197 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1256 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
… | |
… | |
1223 | |
1282 | |
1224 | #ifdef XPM_BACKGROUND |
1283 | #ifdef XPM_BACKGROUND |
1225 | if (rs[Rs_backgroundPixmap] != NULL |
1284 | if (rs[Rs_backgroundPixmap] != NULL |
1226 | && ! (Options & Opt_transparent)) |
1285 | && ! (Options & Opt_transparent)) |
1227 | { |
1286 | { |
1228 | const char *p = rs[Rs_backgroundPixmap]; |
1287 | const char *p = rs[Rs_backgroundPixmap]; |
1229 | |
1288 | |
1230 | if ((p = STRCHR (p, ';')) != NULL) |
1289 | if ((p = STRCHR (p, ';')) != NULL) |
1231 | { |
1290 | { |
1232 | p++; |
1291 | p++; |
1233 | scale_pixmap (p); |
1292 | scale_pixmap (p); |
… | |
… | |
1250 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1309 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1251 | gcvalue.foreground = PixColors[Color_topShadow]; |
1310 | gcvalue.foreground = PixColors[Color_topShadow]; |
1252 | topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1311 | topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1253 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1312 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1254 | botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1313 | botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1255 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; |
1314 | gcvalue.foreground = PixColors[ (display->depth <= 2 ? Color_fg : Color_scroll)]; |
1256 | scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1315 | scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
|
|
1316 | #endif |
|
|
1317 | |
|
|
1318 | #ifdef OFF_FOCUS_FADING |
|
|
1319 | // initially we are in unfocused state |
|
|
1320 | if (rs[Rs_fade]) |
|
|
1321 | PixColors = PixColorsUnFocused; |
1257 | #endif |
1322 | #endif |
1258 | } |
1323 | } |
1259 | |
1324 | |
1260 | /*----------------------------------------------------------------------*/ |
1325 | /*----------------------------------------------------------------------*/ |
1261 | /* |
1326 | /* |
… | |
… | |
1285 | { |
1350 | { |
1286 | close (cfd); |
1351 | close (cfd); |
1287 | rxvt_fatal ("can't open slave tty %s", ttydev); |
1352 | rxvt_fatal ("can't open slave tty %s", ttydev); |
1288 | } |
1353 | } |
1289 | } |
1354 | } |
|
|
1355 | |
1290 | #ifndef NO_BACKSPACE_KEY |
1356 | #ifndef NO_BACKSPACE_KEY |
1291 | if (key_backspace[0] && !key_backspace[1]) |
1357 | if (key_backspace[0] && !key_backspace[1]) |
1292 | er = key_backspace[0]; |
1358 | er = key_backspace[0]; |
1293 | else if (STRCMP (key_backspace, "DEC") == 0) |
1359 | else if (STRCMP (key_backspace, "DEC") == 0) |
1294 | er = '\177'; /* the initial state anyway */ |
1360 | er = '\177'; /* the initial state anyway */ |
1295 | else |
1361 | else |
1296 | #endif |
1362 | #endif |
1297 | |
|
|
1298 | er = -1; |
1363 | er = -1; |
1299 | |
1364 | |
1300 | rxvt_get_ttymode (& (tio), er); |
1365 | rxvt_get_ttymode (&tio, er); |
1301 | |
1366 | |
1302 | #ifndef __QNX__ |
1367 | #ifndef __QNX__ |
1303 | /* spin off the command interpreter */ |
1368 | /* spin off the command interpreter */ |
1304 | switch (cmd_pid = fork ()) |
1369 | switch (cmd_pid = fork ()) |
1305 | { |
1370 | { |
… | |
… | |
1386 | #elif defined (SRIOCSREDIR) |
1451 | #elif defined (SRIOCSREDIR) |
1387 | int fd; |
1452 | int fd; |
1388 | |
1453 | |
1389 | fd = open (CONSOLE, O_WRONLY, 0); |
1454 | fd = open (CONSOLE, O_WRONLY, 0); |
1390 | if (fd >= 0) |
1455 | if (fd >= 0) |
1391 | { |
|
|
1392 | if (ioctl (fd, SRIOCSREDIR, NULL) < 0) |
1456 | if (ioctl (fd, SRIOCSREDIR, NULL) < 0) |
1393 | close (fd); |
1457 | close (fd); |
1394 | } |
|
|
1395 | #endif /* SRIOCSREDIR */ |
1458 | #endif /* SRIOCSREDIR */ |
1396 | |
1459 | |
1397 | } |
1460 | } |
1398 | |
1461 | |
1399 | /* reset signals and spin off the command interpreter */ |
1462 | /* reset signals and spin off the command interpreter */ |