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.113 by root, Sat Feb 19 04:16:49 2005 UTC vs.
Revision 1.118 by root, Wed Aug 10 15:10:06 2005 UTC

185 "INCR", 185 "INCR",
186 "WM_PROTOCOLS", 186 "WM_PROTOCOLS",
187 "WM_DELETE_WINDOW", 187 "WM_DELETE_WINDOW",
188 "CLIPBOARD", 188 "CLIPBOARD",
189#if ENABLE_FRILLS 189#if ENABLE_FRILLS
190 "_MOTIF_WM_HINTS",
191#endif
192#if ENABLE_EWMH
190 "_NET_WM_PID", 193 "_NET_WM_PID",
191 "_MOTIF_WM_HINTS",
192 "_NET_WM_NAME", 194 "_NET_WM_NAME",
193 "_NET_WM_ICON_NAME", 195 "_NET_WM_ICON_NAME",
196 "_NET_WM_PING",
194#endif 197#endif
195#if USE_XIM 198#if USE_XIM
196 "WM_LOCALE_NAME", 199 "WM_LOCALE_NAME",
197#endif 200#endif
198#ifdef TRANSPARENT 201#ifdef TRANSPARENT
203 "DndProtocol", 206 "DndProtocol",
204 "DndSelection", 207 "DndSelection",
205#endif 208#endif
206#if ENABLE_XEMBED 209#if ENABLE_XEMBED
207 "_XEMBED", 210 "_XEMBED",
211 "_XEMBED_INFO",
208#endif 212#endif
209 }; 213 };
210 214
211bool 215bool
212rxvt_term::init_vars () 216rxvt_term::init_vars ()
340 if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) 344 if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL)
341 rs[Rs_display_name] = ":0"; 345 rs[Rs_display_name] = ":0";
342 346
343 get_options (r_argc, r_argv); 347 get_options (r_argc, r_argv);
344 348
345#ifdef LOCAL_X_IS_UNIX
346 if (rs[Rs_display_name][0] == ':')
347 {
348 val = rxvt_malloc (5 + strlen (rs[Rs_display_name]));
349 strcpy (val, "unix");
350 strcat (val, rs[Rs_display_name]);
351 display = displays.get (val);
352 free (val);
353 }
354#endif
355
356 if (!display
357 && ! (display = displays.get (rs[Rs_display_name]))) 349 if (!(display = displays.get (rs[Rs_display_name])))
358 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); 350 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
359 351
360 extract_resources (); 352 extract_resources ();
361 free (r_argv); 353 free (r_argv);
362 354
768 * from the fvwm window manager. 760 * from the fvwm window manager.
769 */ 761 */
770#ifdef KEEP_SCROLLCOLOR 762#ifdef KEEP_SCROLLCOLOR
771 763
772 if (display->depth <= 2) 764 if (display->depth <= 2)
765 {
773 { /* Monochrome */ 766 /* Monochrome */
774 pix_colors[Color_scroll] = pix_colors[Color_fg]; 767 pix_colors[Color_scroll] = pix_colors[Color_fg];
775 pix_colors[Color_topShadow] = pix_colors[Color_bg]; 768 pix_colors[Color_topShadow] = pix_colors[Color_bg];
776 pix_colors[Color_bottomShadow] = pix_colors[Color_bg]; 769 pix_colors[Color_bottomShadow] = pix_colors[Color_bg];
777 } 770 }
778 else 771 else
929#endif 922#endif
930 XGCValues gcvalue; 923 XGCValues gcvalue;
931 long vt_emask; 924 long vt_emask;
932 XSetWindowAttributes attributes; 925 XSetWindowAttributes attributes;
933 XWindowAttributes gattr; 926 XWindowAttributes gattr;
934 Window top; 927 Window top, parent;
935 dDisp; 928 dDisp;
936 929
937#ifdef USING_W11LIB 930#ifdef USING_W11LIB
938 /* enable W11 callbacks */ 931 /* enable W11 callbacks */
939 W11AddEventHandler (disp, rxvt_W11_process_x_event); 932 W11AddEventHandler (disp, rxvt_W11_process_x_event);
966 mwmhints.flags = MWM_HINTS_DECORATIONS; 959 mwmhints.flags = MWM_HINTS_DECORATIONS;
967 mwmhints.decorations = 0; 960 mwmhints.decorations = 0;
968 } 961 }
969 } 962 }
970 else 963 else
971 {
972 mwmhints.flags = 0; 964 mwmhints.flags = 0;
973 }
974#endif 965#endif
975 966
976 /* grab colors before netscape does */ 967 /* grab colors before netscape does */
977 Get_Colours (); 968 Get_Colours ();
978 969
979 if (!set_fonts ()) 970 if (!set_fonts ())
980 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); 971 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
981 972
973 parent = DefaultRootWindow (disp);
974
982#if ENABLE_XEMBED 975#if ENABLE_XEMBED
983 if (rs[Rs_embed]) 976 if (rs[Rs_embed])
984 { 977 {
985 XWindowAttributes wattr; 978 XWindowAttributes wattr;
986 979
987 top = strtol (rs[Rs_embed], 0, 0); 980 parent = strtol (rs[Rs_embed], 0, 0);
988 981
989 if (!XGetWindowAttributes (disp, top, &wattr)) 982 if (!XGetWindowAttributes (disp, parent, &wattr))
990 rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); 983 rxvt_fatal ("invalid window-id specified with -embed, aborting.\n");
991 984
992 window_calc (wattr.width, wattr.height); 985 window_calc (wattr.width, wattr.height);
986 }
993 987
994#if 0 988#endif
995 if (wattr.map_state == IsViewable) 989 window_calc (0, 0);
996 { 990
997 TermWin.mapped = 1; 991 /* sub-window placement & size in rxvt_resize_subwindows () */
998 refresh_type = FAST_REFRESH; 992#ifdef PREFER_24BIT
999 XClearWindow (disp, top); 993 attributes.background_pixel = pix_colors_focused[Color_border];
1000 // TODO: make XMapNotify-event-code a function and call it 994 attributes.border_pixel = pix_colors_focused[Color_border];
1001 // TODO: how can I detect visibility without unmap/map? 995 attributes.colormap = display->cmap;
1002 // TODO: focusin etc. 996 top = XCreateWindow (disp, parent,
1003 } 997 szHint.x, szHint.y,
998 szHint.width, szHint.height,
999 TermWin.ext_bwidth,
1000 display->depth, InputOutput,
1001 display->visual,
1002 CWColormap | CWBackPixel | CWBorderPixel, &attributes);
1004#else 1003#else
1005 // it's easiest just to unmap/map to get all state correctly set-up 1004 top = XCreateSimpleWindow (disp, parent,
1006 XUnmapWindow (disp, top);
1007#endif
1008 }
1009 else
1010#endif
1011 {
1012 window_calc (0, 0);
1013
1014 /* sub-window placement & size in rxvt_resize_subwindows () */
1015#ifdef PREFER_24BIT
1016 attributes.background_pixel = pix_colors_focused[Color_border];
1017 attributes.border_pixel = pix_colors_focused[Color_border];
1018 attributes.colormap = display->cmap;
1019 top = XCreateWindow (disp, DefaultRootWindow (disp),
1020 szHint.x, szHint.y, 1005 szHint.x, szHint.y,
1021 szHint.width, szHint.height, 1006 szHint.width, szHint.height,
1022 TermWin.ext_bwidth, 1007 TermWin.ext_bwidth,
1023 display->depth, InputOutput,
1024 display->visual,
1025 CWColormap | CWBackPixel | CWBorderPixel, &attributes);
1026#else
1027 top = XCreateSimpleWindow (disp, DefaultRootWindow (disp),
1028 szHint.x, szHint.y,
1029 szHint.width, szHint.height,
1030 TermWin.ext_bwidth,
1031 pix_colors_focused[Color_border], 1008 pix_colors_focused[Color_border],
1032 pix_colors_focused[Color_border]); 1009 pix_colors_focused[Color_border]);
1033#endif 1010#endif
1034 }
1035 1011
1036 TermWin.parent[0] = top; 1012 TermWin.parent[0] = top;
1037 1013
1038 old_width = szHint.width; 1014 old_width = szHint.width;
1039 old_height = szHint.height; 1015 old_height = szHint.height;
1047 wmHint.flags = InputHint | StateHint | WindowGroupHint; 1023 wmHint.flags = InputHint | StateHint | WindowGroupHint;
1048 wmHint.input = True; 1024 wmHint.input = True;
1049 wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState; 1025 wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState;
1050 wmHint.window_group = top; 1026 wmHint.window_group = top;
1051 1027
1052 XSetWMProperties (disp, top, NULL, NULL, 1028 XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc,
1053 (char **)argv, argc, &szHint, &wmHint, &classHint); 1029 &szHint, &wmHint, &classHint);
1054 1030
1055 /* Enable delete window protocol */ 1031 Atom protocols[] = {
1056 XSetWMProtocols (disp, top, &xa[XA_WM_DELETE_WINDOW], 1); 1032 xa[XA_WM_DELETE_WINDOW],
1033#if ENABLE_EWMH
1034 xa[XA_NET_WM_PING],
1035#endif
1036 };
1057 1037
1058#if ENABLE_FRILLS 1038 XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0]));
1039
1040#if ENABLE_EWMH
1059 long pid = getpid (); 1041 long pid = getpid ();
1060 1042
1061 XChangeProperty (disp, top, 1043 XChangeProperty (disp, top,
1062 xa[XA_NET_WM_PID], XA_CARDINAL, 32, 1044 xa[XA_NET_WM_PID], XA_CARDINAL, 32,
1063 PropModeReplace, (unsigned char *)&pid, 1); 1045 PropModeReplace, (unsigned char *)&pid, 1);
1046
1047 // _NET_WM_WINDOW_TYPE is NORMAL, which is the default
1064#endif 1048#endif
1065 1049
1066 XSelectInput (disp, top, 1050 XSelectInput (disp, top,
1067 KeyPressMask 1051 KeyPressMask
1068#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 1052#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755
1185 1169
1186 pointer_unblank (); 1170 pointer_unblank ();
1187 scr_recolour (); 1171 scr_recolour ();
1188 1172
1189#if ENABLE_XEMBED 1173#if ENABLE_XEMBED
1190 // why this is necessary, I don't know, race condition?? 1174 if (rs[Rs_embed])
1191 XMoveWindow (disp, TermWin.vt, window_vt_x, window_vt_y); 1175 {
1176 long info[2] = { 0, XEMBED_MAPPED };
1177
1178 XChangeProperty (disp, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO],
1179 32, PropModeReplace, (unsigned char *)&info, 2);
1180 }
1192#endif 1181#endif
1193} 1182}
1194 1183
1195/* ------------------------------------------------------------------------- * 1184/* ------------------------------------------------------------------------- *
1196 * GET TTY CURRENT STATE * 1185 * GET TTY CURRENT STATE *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines