… | |
… | |
174 | #if OFF_FOCUS_FADING |
174 | #if OFF_FOCUS_FADING |
175 | "black", |
175 | "black", |
176 | #endif |
176 | #endif |
177 | }; |
177 | }; |
178 | |
178 | |
179 | const char *const xa_names[] = |
|
|
180 | { |
|
|
181 | "TEXT", |
|
|
182 | "COMPOUND_TEXT", |
|
|
183 | "UTF8_STRING", |
|
|
184 | "MULTIPLE", |
|
|
185 | "TARGETS", |
|
|
186 | "TIMESTAMP", |
|
|
187 | "VT_SELECTION", |
|
|
188 | "INCR", |
|
|
189 | "WM_PROTOCOLS", |
|
|
190 | "WM_DELETE_WINDOW", |
|
|
191 | "CLIPBOARD", |
|
|
192 | #if ENABLE_FRILLS |
|
|
193 | "_MOTIF_WM_HINTS", |
|
|
194 | #endif |
|
|
195 | #if ENABLE_EWMH |
|
|
196 | "_NET_WM_PID", |
|
|
197 | "_NET_WM_NAME", |
|
|
198 | "_NET_WM_ICON_NAME", |
|
|
199 | "_NET_WM_PING", |
|
|
200 | #endif |
|
|
201 | #if USE_XIM |
|
|
202 | "WM_LOCALE_NAME", |
|
|
203 | #endif |
|
|
204 | #ifdef TRANSPARENT |
|
|
205 | "_XROOTPMAP_ID", |
|
|
206 | "ESETROOT_PMAP_ID", |
|
|
207 | #endif |
|
|
208 | #if ENABLE_XEMBED |
|
|
209 | "_XEMBED", |
|
|
210 | "_XEMBED_INFO", |
|
|
211 | #endif |
|
|
212 | }; |
|
|
213 | |
|
|
214 | bool |
179 | bool |
215 | rxvt_term::init_vars () |
180 | rxvt_term::init_vars () |
216 | { |
181 | { |
217 | pix_colors_focused = new rxvt_color [TOTAL_COLORS]; |
182 | pix_colors_focused = new rxvt_color [TOTAL_COLORS]; |
218 | #ifdef OFF_FOCUS_FADING |
183 | #ifdef OFF_FOCUS_FADING |
… | |
… | |
914 | rxvt_term::create_windows (int argc, const char *const *argv) |
879 | rxvt_term::create_windows (int argc, const char *const *argv) |
915 | { |
880 | { |
916 | XClassHint classHint; |
881 | XClassHint classHint; |
917 | XWMHints wmHint; |
882 | XWMHints wmHint; |
918 | #if ENABLE_FRILLS |
883 | #if ENABLE_FRILLS |
919 | Atom prop = None; |
|
|
920 | MWMHints mwmhints; |
884 | MWMHints mwmhints; |
921 | #endif |
885 | #endif |
922 | XGCValues gcvalue; |
886 | XGCValues gcvalue; |
923 | XSetWindowAttributes attributes; |
887 | XSetWindowAttributes attributes; |
924 | XWindowAttributes gattr; |
|
|
925 | Window top, parent; |
888 | Window top, parent; |
926 | dDisp; |
889 | dDisp; |
927 | |
890 | |
928 | #ifdef USING_W11LIB |
891 | xa = display->xa; |
929 | /* enable W11 callbacks */ |
|
|
930 | W11AddEventHandler (disp, rxvt_W11_process_x_event); |
|
|
931 | #endif |
|
|
932 | |
|
|
933 | assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); |
|
|
934 | XInternAtoms (disp, (char **)xa_names, NUM_XA, False, xa); |
|
|
935 | |
|
|
936 | if (OPTION (Opt_transparent)) |
|
|
937 | { |
|
|
938 | XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr); |
|
|
939 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
|
|
940 | } |
|
|
941 | |
892 | |
942 | /* grab colors before netscape does */ |
893 | /* grab colors before netscape does */ |
943 | Get_Colours (); |
894 | Get_Colours (); |
944 | |
895 | |
945 | if (!set_fonts ()) |
896 | if (!set_fonts ()) |
946 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
897 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
947 | |
898 | |
948 | parent = DefaultRootWindow (disp); |
899 | parent = display->root; |
949 | |
900 | |
950 | attributes.override_redirect = !!OPTION (Opt_override_redirect); |
901 | attributes.override_redirect = !!OPTION (Opt_override_redirect); |
951 | |
902 | |
952 | #if ENABLE_FRILLS |
903 | #if ENABLE_FRILLS |
953 | if (OPTION (Opt_borderLess)) |
904 | if (OPTION (Opt_borderLess)) |
954 | { |
905 | { |
955 | prop = XInternAtom (disp, "_MOTIF_WM_INFO", True); |
906 | if (XInternAtom (disp, "_MOTIF_WM_INFO", True) == None) |
956 | |
|
|
957 | if (prop == None) |
|
|
958 | { |
907 | { |
959 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
908 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
960 | attributes.override_redirect = TRUE; |
909 | attributes.override_redirect = TRUE; |
961 | mwmhints.flags = 0; |
910 | mwmhints.flags = 0; |
962 | } |
911 | } |
… | |
… | |
986 | |
935 | |
987 | window_calc (0, 0); |
936 | window_calc (0, 0); |
988 | |
937 | |
989 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
938 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
990 | attributes.background_pixel = pix_colors_focused[Color_border]; |
939 | attributes.background_pixel = pix_colors_focused[Color_border]; |
991 | attributes.border_pixel = pix_colors_focused[Color_border]; |
940 | attributes.border_pixel = pix_colors_focused[Color_border]; |
992 | attributes.colormap = display->cmap; |
941 | attributes.colormap = display->cmap; |
|
|
942 | |
993 | top = XCreateWindow (disp, parent, |
943 | top = XCreateWindow (disp, parent, |
994 | szHint.x, szHint.y, |
944 | szHint.x, szHint.y, |
995 | szHint.width, szHint.height, |
945 | szHint.width, szHint.height, |
996 | ext_bwidth, |
946 | ext_bwidth, |
997 | display->depth, InputOutput, |
947 | display->depth, InputOutput, |
… | |
… | |
1002 | this->parent[0] = top; |
952 | this->parent[0] = top; |
1003 | |
953 | |
1004 | old_width = szHint.width; |
954 | old_width = szHint.width; |
1005 | old_height = szHint.height; |
955 | old_height = szHint.height; |
1006 | |
956 | |
1007 | process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); |
957 | process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); |
1008 | process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); |
958 | process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); |
1009 | |
959 | |
1010 | classHint.res_name = (char *)rs[Rs_name]; |
960 | classHint.res_name = (char *)rs[Rs_name]; |
1011 | classHint.res_class = (char *)RESCLASS; |
961 | classHint.res_class = (char *)RESCLASS; |
1012 | |
962 | |
1013 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
963 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
1014 | wmHint.input = True; |
964 | wmHint.input = True; |
1015 | wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; |
965 | wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; |
1016 | wmHint.window_group = top; |
966 | wmHint.window_group = top; |
1017 | |
967 | |
1018 | XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, |
968 | XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, |
1019 | &szHint, &wmHint, &classHint); |
969 | &szHint, &wmHint, &classHint); |
|
|
970 | |
|
|
971 | #if ENABLE_FRILLS |
|
|
972 | if (mwmhints.flags) |
|
|
973 | XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
|
|
974 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
|
|
975 | #endif |
1020 | |
976 | |
1021 | Atom protocols[] = { |
977 | Atom protocols[] = { |
1022 | xa[XA_WM_DELETE_WINDOW], |
978 | xa[XA_WM_DELETE_WINDOW], |
1023 | #if ENABLE_EWMH |
979 | #if ENABLE_EWMH |
1024 | xa[XA_NET_WM_PING], |
980 | xa[XA_NET_WM_PING], |
… | |
… | |
1050 | | FocusChangeMask | VisibilityChangeMask |
1006 | | FocusChangeMask | VisibilityChangeMask |
1051 | | ExposureMask | StructureNotifyMask); |
1007 | | ExposureMask | StructureNotifyMask); |
1052 | |
1008 | |
1053 | termwin_ev.start (display, top); |
1009 | termwin_ev.start (display, top); |
1054 | |
1010 | |
1055 | #if ENABLE_FRILLS |
|
|
1056 | if (mwmhints.flags) |
|
|
1057 | XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
|
|
1058 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
|
|
1059 | #endif |
|
|
1060 | |
|
|
1061 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1011 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1062 | TermWin_cursor = XCreateFontCursor (disp, XC_xterm); |
1012 | TermWin_cursor = XCreateFontCursor (disp, XC_xterm); |
1063 | |
1013 | |
1064 | #ifdef HAVE_SCROLLBARS |
1014 | #ifdef HAVE_SCROLLBARS |
1065 | /* cursor scrollBar: Black-on-White */ |
1015 | /* cursor scrollBar: Black-on-White */ |
1066 | leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); |
1016 | leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); |
1067 | #endif |
1017 | #endif |
1068 | |
1018 | |
1069 | /* the vt window */ |
1019 | /* the vt window */ |
1070 | vt = XCreateSimpleWindow (disp, top, |
1020 | vt = XCreateSimpleWindow (disp, top, |
1071 | window_vt_x, |
|
|
1072 | window_vt_y, |
1021 | window_vt_x, window_vt_y, |
1073 | width, |
|
|
1074 | height, |
1022 | width, height, |
1075 | 0, |
1023 | 0, |
1076 | pix_colors_focused[Color_fg], |
1024 | pix_colors_focused[Color_fg], |
1077 | pix_colors_focused[Color_bg]); |
1025 | pix_colors_focused[Color_bg]); |
1078 | #ifdef DEBUG_X |
|
|
1079 | XStoreName (disp, vt, "vt window"); |
|
|
1080 | #endif |
|
|
1081 | |
1026 | |
1082 | attributes.bit_gravity = NorthWestGravity; |
1027 | attributes.bit_gravity = NorthWestGravity; |
1083 | XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); |
1028 | XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); |
1084 | |
1029 | |
1085 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1030 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
… | |
… | |
1109 | scr_touch (true); |
1054 | scr_touch (true); |
1110 | } |
1055 | } |
1111 | #endif |
1056 | #endif |
1112 | |
1057 | |
1113 | /* graphics context for the vt window */ |
1058 | /* graphics context for the vt window */ |
1114 | gcvalue.foreground = pix_colors[Color_fg]; |
1059 | gcvalue.foreground = pix_colors[Color_fg]; |
1115 | gcvalue.background = pix_colors[Color_bg]; |
1060 | gcvalue.background = pix_colors[Color_bg]; |
1116 | gcvalue.graphics_exposures = 1; |
1061 | gcvalue.graphics_exposures = 1; |
|
|
1062 | |
1117 | gc = XCreateGC (disp, vt, |
1063 | gc = XCreateGC (disp, vt, |
1118 | GCForeground | GCBackground | GCGraphicsExposures, |
1064 | GCForeground | GCBackground | GCGraphicsExposures, |
1119 | &gcvalue); |
1065 | &gcvalue); |
1120 | |
1066 | |
1121 | drawable = new rxvt_drawable (display, vt); |
1067 | drawable = new rxvt_drawable (display, vt); |
1122 | |
1068 | |
1123 | #ifdef RXVT_SCROLLBAR |
1069 | #ifdef RXVT_SCROLLBAR |
1124 | gcvalue.foreground = pix_colors[Color_topShadow]; |
1070 | gcvalue.foreground = pix_colors[Color_topShadow]; |
… | |
… | |
1135 | pix_colors = pix_colors_unfocused; |
1081 | pix_colors = pix_colors_unfocused; |
1136 | #endif |
1082 | #endif |
1137 | |
1083 | |
1138 | pointer_unblank (); |
1084 | pointer_unblank (); |
1139 | scr_recolour (); |
1085 | scr_recolour (); |
1140 | |
|
|
1141 | #if ENABLE_XEMBED |
|
|
1142 | if (rs[Rs_embed]) |
|
|
1143 | { |
|
|
1144 | long info[2] = { 0, XEMBED_MAPPED }; |
|
|
1145 | |
|
|
1146 | XChangeProperty (disp, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
|
|
1147 | 32, PropModeReplace, (unsigned char *)&info, 2); |
|
|
1148 | } |
|
|
1149 | #endif |
|
|
1150 | } |
1086 | } |
1151 | |
1087 | |
1152 | /* ------------------------------------------------------------------------- * |
1088 | /* ------------------------------------------------------------------------- * |
1153 | * GET TTY CURRENT STATE * |
1089 | * GET TTY CURRENT STATE * |
1154 | * ------------------------------------------------------------------------- */ |
1090 | * ------------------------------------------------------------------------- */ |