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.151 by root, Fri Jan 20 12:16:28 2006 UTC vs.
Revision 1.154 by root, Wed Jan 25 02:45:36 2006 UTC

174#if OFF_FOCUS_FADING 174#if OFF_FOCUS_FADING
175 "black", 175 "black",
176#endif 176#endif
177 }; 177 };
178 178
179const 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
214bool 179bool
215rxvt_term::init_vars () 180rxvt_term::init_vars ()
216{ 181{
182 pix_colors = //
217 pix_colors_focused = new rxvt_color [TOTAL_COLORS]; 183 pix_colors_focused = new rxvt_color [TOTAL_COLORS];
218#ifdef OFF_FOCUS_FADING 184#ifdef OFF_FOCUS_FADING
219 pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; 185 pix_colors_unfocused = new rxvt_color [TOTAL_COLORS];
220#endif 186#endif
221 pix_colors = pix_colors_focused;
222
223 if (pix_colors == NULL)
224 return false;
225 187
226#if defined(XPM_BACKGROUND) || defined(TRANSPARENT) 188#if defined(XPM_BACKGROUND) || defined(TRANSPARENT)
227 pixmap = None; 189 pixmap = None;
228#endif 190#endif
229 191
914rxvt_term::create_windows (int argc, const char *const *argv) 876rxvt_term::create_windows (int argc, const char *const *argv)
915{ 877{
916 XClassHint classHint; 878 XClassHint classHint;
917 XWMHints wmHint; 879 XWMHints wmHint;
918#if ENABLE_FRILLS 880#if ENABLE_FRILLS
919 Atom prop = None;
920 MWMHints mwmhints; 881 MWMHints mwmhints;
921#endif 882#endif
922 XGCValues gcvalue; 883 XGCValues gcvalue;
923 XSetWindowAttributes attributes; 884 XSetWindowAttributes attributes;
924 XWindowAttributes gattr;
925 Window top, parent; 885 Window top, parent;
926 dDisp; 886 dDisp;
927 887
928#ifdef USING_W11LIB 888 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 889
942 /* grab colors before netscape does */ 890 /* grab colors before netscape does */
943 Get_Colours (); 891 Get_Colours ();
944 892
945 if (!set_fonts ()) 893 if (!set_fonts ())
946 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); 894 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
947 895
948 parent = DefaultRootWindow (disp); 896 parent = display->root;
949 897
950 attributes.override_redirect = !!OPTION (Opt_override_redirect); 898 attributes.override_redirect = !!OPTION (Opt_override_redirect);
951 899
952#if ENABLE_FRILLS 900#if ENABLE_FRILLS
953 if (OPTION (Opt_borderLess)) 901 if (OPTION (Opt_borderLess))
954 { 902 {
955 prop = XInternAtom (disp, "_MOTIF_WM_INFO", True); 903 if (XInternAtom (disp, "_MOTIF_WM_INFO", True) == None)
956
957 if (prop == None)
958 { 904 {
959 /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ 905 /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/
960 attributes.override_redirect = TRUE; 906 attributes.override_redirect = TRUE;
961 mwmhints.flags = 0; 907 mwmhints.flags = 0;
962 } 908 }
986 932
987 window_calc (0, 0); 933 window_calc (0, 0);
988 934
989 /* sub-window placement & size in rxvt_resize_subwindows () */ 935 /* sub-window placement & size in rxvt_resize_subwindows () */
990 attributes.background_pixel = pix_colors_focused[Color_border]; 936 attributes.background_pixel = pix_colors_focused[Color_border];
991 attributes.border_pixel = pix_colors_focused[Color_border]; 937 attributes.border_pixel = pix_colors_focused[Color_border];
992 attributes.colormap = display->cmap; 938 attributes.colormap = display->cmap;
939
993 top = XCreateWindow (disp, parent, 940 top = XCreateWindow (disp, parent,
994 szHint.x, szHint.y, 941 szHint.x, szHint.y,
995 szHint.width, szHint.height, 942 szHint.width, szHint.height,
996 ext_bwidth, 943 ext_bwidth,
997 display->depth, InputOutput, 944 display->depth, InputOutput,
1002 this->parent[0] = top; 949 this->parent[0] = top;
1003 950
1004 old_width = szHint.width; 951 old_width = szHint.width;
1005 old_height = szHint.height; 952 old_height = szHint.height;
1006 953
1007 process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); 954 process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
1008 process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); 955 process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST);
1009 956
1010 classHint.res_name = (char *)rs[Rs_name]; 957 classHint.res_name = (char *)rs[Rs_name];
1011 classHint.res_class = (char *)RESCLASS; 958 classHint.res_class = (char *)RESCLASS;
1012 959
1013 wmHint.flags = InputHint | StateHint | WindowGroupHint; 960 wmHint.flags = InputHint | StateHint | WindowGroupHint;
1014 wmHint.input = True; 961 wmHint.input = True;
1015 wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; 962 wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState;
1016 wmHint.window_group = top; 963 wmHint.window_group = top;
1017 964
1018 XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, 965 XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc,
1019 &szHint, &wmHint, &classHint); 966 &szHint, &wmHint, &classHint);
967
968#if ENABLE_FRILLS
969 if (mwmhints.flags)
970 XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32,
971 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS);
972#endif
1020 973
1021 Atom protocols[] = { 974 Atom protocols[] = {
1022 xa[XA_WM_DELETE_WINDOW], 975 xa[XA_WM_DELETE_WINDOW],
1023#if ENABLE_EWMH 976#if ENABLE_EWMH
1024 xa[XA_NET_WM_PING], 977 xa[XA_NET_WM_PING],
1050 | FocusChangeMask | VisibilityChangeMask 1003 | FocusChangeMask | VisibilityChangeMask
1051 | ExposureMask | StructureNotifyMask); 1004 | ExposureMask | StructureNotifyMask);
1052 1005
1053 termwin_ev.start (display, top); 1006 termwin_ev.start (display, top);
1054 1007
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 */ 1008 /* vt cursor: Black-on-White is standard, but this is more popular */
1062 TermWin_cursor = XCreateFontCursor (disp, XC_xterm); 1009 TermWin_cursor = XCreateFontCursor (disp, XC_xterm);
1063 1010
1064#ifdef HAVE_SCROLLBARS 1011#ifdef HAVE_SCROLLBARS
1065 /* cursor scrollBar: Black-on-White */ 1012 /* cursor scrollBar: Black-on-White */
1066 leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); 1013 leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr);
1067#endif 1014#endif
1068 1015
1069 /* the vt window */ 1016 /* the vt window */
1070 vt = XCreateSimpleWindow (disp, top, 1017 vt = XCreateSimpleWindow (disp, top,
1071 window_vt_x,
1072 window_vt_y, 1018 window_vt_x, window_vt_y,
1073 width,
1074 height, 1019 width, height,
1075 0, 1020 0,
1076 pix_colors_focused[Color_fg], 1021 pix_colors_focused[Color_fg],
1077 pix_colors_focused[Color_bg]); 1022 pix_colors_focused[Color_bg]);
1078#ifdef DEBUG_X
1079 XStoreName (disp, vt, "vt window");
1080#endif
1081 1023
1082 attributes.bit_gravity = NorthWestGravity; 1024 attributes.bit_gravity = NorthWestGravity;
1083 XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); 1025 XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes);
1084 1026
1085 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; 1027 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
1093 1035
1094 vt_ev.start (display, vt); 1036 vt_ev.start (display, vt);
1095 1037
1096#ifdef XPM_BACKGROUND 1038#ifdef XPM_BACKGROUND
1097 if (rs[Rs_backgroundPixmap] != NULL 1039 if (rs[Rs_backgroundPixmap] != NULL
1098 && ! OPTION (Opt_transparent)) 1040 && !OPTION (Opt_transparent))
1099 { 1041 {
1100 const char *p = rs[Rs_backgroundPixmap]; 1042 const char *p = rs[Rs_backgroundPixmap];
1101 1043
1102 if ((p = strchr (p, ';')) != NULL) 1044 if ((p = strchr (p, ';')) != NULL)
1103 { 1045 {
1109 scr_touch (true); 1051 scr_touch (true);
1110 } 1052 }
1111#endif 1053#endif
1112 1054
1113 /* graphics context for the vt window */ 1055 /* graphics context for the vt window */
1114 gcvalue.foreground = pix_colors[Color_fg]; 1056 gcvalue.foreground = pix_colors[Color_fg];
1115 gcvalue.background = pix_colors[Color_bg]; 1057 gcvalue.background = pix_colors[Color_bg];
1116 gcvalue.graphics_exposures = 1; 1058 gcvalue.graphics_exposures = 1;
1059
1117 gc = XCreateGC (disp, vt, 1060 gc = XCreateGC (disp, vt,
1118 GCForeground | GCBackground | GCGraphicsExposures, 1061 GCForeground | GCBackground | GCGraphicsExposures,
1119 &gcvalue); 1062 &gcvalue);
1120 1063
1121 drawable = new rxvt_drawable (display, vt); 1064 drawable = new rxvt_drawable (display, vt);
1122 1065
1123#ifdef RXVT_SCROLLBAR 1066#ifdef RXVT_SCROLLBAR
1124 gcvalue.foreground = pix_colors[Color_topShadow]; 1067 gcvalue.foreground = pix_colors[Color_topShadow];
1135 pix_colors = pix_colors_unfocused; 1078 pix_colors = pix_colors_unfocused;
1136#endif 1079#endif
1137 1080
1138 pointer_unblank (); 1081 pointer_unblank ();
1139 scr_recolour (); 1082 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} 1083}
1151 1084
1152/* ------------------------------------------------------------------------- * 1085/* ------------------------------------------------------------------------- *
1153 * GET TTY CURRENT STATE * 1086 * GET TTY CURRENT STATE *
1154 * ------------------------------------------------------------------------- */ 1087 * ------------------------------------------------------------------------- */
1444 } 1377 }
1445 1378
1446 _exit (EXIT_FAILURE); 1379 _exit (EXIT_FAILURE);
1447 1380
1448 default: 1381 default:
1449#if UTMP_SUPPORT
1450 if (!OPTION (Opt_utmpInhibit)) 1382 if (!OPTION (Opt_utmpInhibit))
1451 pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); 1383 pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]);
1452#endif
1453 1384
1454 pty->close_tty (); 1385 pty->close_tty ();
1455 1386
1456 child_ev.start (cmd_pid); 1387 child_ev.start (cmd_pid);
1457 1388

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines