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.112 by root, Sat Feb 19 01:07:58 2005 UTC vs.
Revision 1.116 by root, Sun Feb 20 19:45:30 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 ()
929#endif 933#endif
930 XGCValues gcvalue; 934 XGCValues gcvalue;
931 long vt_emask; 935 long vt_emask;
932 XSetWindowAttributes attributes; 936 XSetWindowAttributes attributes;
933 XWindowAttributes gattr; 937 XWindowAttributes gattr;
934 Window top; 938 Window top, parent;
935 dDisp; 939 dDisp;
936 940
937#ifdef USING_W11LIB 941#ifdef USING_W11LIB
938 /* enable W11 callbacks */ 942 /* enable W11 callbacks */
939 W11AddEventHandler (disp, rxvt_W11_process_x_event); 943 W11AddEventHandler (disp, rxvt_W11_process_x_event);
966 mwmhints.flags = MWM_HINTS_DECORATIONS; 970 mwmhints.flags = MWM_HINTS_DECORATIONS;
967 mwmhints.decorations = 0; 971 mwmhints.decorations = 0;
968 } 972 }
969 } 973 }
970 else 974 else
971 {
972 mwmhints.flags = 0; 975 mwmhints.flags = 0;
973 }
974#endif 976#endif
975 977
976 /* grab colors before netscape does */ 978 /* grab colors before netscape does */
977 Get_Colours (); 979 Get_Colours ();
978 980
979 if (!set_fonts ()) 981 if (!set_fonts ())
980 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); 982 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
981 983
984 parent = DefaultRootWindow (disp);
985
982#if ENABLE_XEMBED 986#if ENABLE_XEMBED
983 if (rs[Rs_embed]) 987 if (rs[Rs_embed])
984 { 988 {
985 XWindowAttributes wattr; 989 XWindowAttributes wattr;
986 990
987 top = strtol (rs[Rs_embed], 0, 0); 991 parent = strtol (rs[Rs_embed], 0, 0);
988 992
989 if (!XGetWindowAttributes (disp, top, &wattr)) 993 if (!XGetWindowAttributes (disp, parent, &wattr))
990 rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); 994 rxvt_fatal ("invalid window-id specified with -embed, aborting.\n");
991 995
992 window_calc (wattr.width, wattr.height); 996 window_calc (wattr.width, wattr.height);
997 }
993 998
994#if 0 999#endif
995 if (wattr.map_state == IsViewable) 1000 window_calc (0, 0);
996 { 1001
997 TermWin.mapped = 1; 1002 /* sub-window placement & size in rxvt_resize_subwindows () */
998 refresh_type = FAST_REFRESH; 1003#ifdef PREFER_24BIT
999 XClearWindow (disp, top); 1004 attributes.background_pixel = pix_colors_focused[Color_border];
1000 // TODO: make XMapNotify-event-code a function and call it 1005 attributes.border_pixel = pix_colors_focused[Color_border];
1001 // TODO: how can I detetc visibility without unmpa/map? 1006 attributes.colormap = display->cmap;
1002 // TODO: focusin etc. 1007 top = XCreateWindow (disp, parent,
1003 } 1008 szHint.x, szHint.y,
1009 szHint.width, szHint.height,
1010 TermWin.ext_bwidth,
1011 display->depth, InputOutput,
1012 display->visual,
1013 CWColormap | CWBackPixel | CWBorderPixel, &attributes);
1004#else 1014#else
1005 // it'S easiets just to unmap/map to get all state correctly set-up 1015 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, 1016 szHint.x, szHint.y,
1021 szHint.width, szHint.height, 1017 szHint.width, szHint.height,
1022 TermWin.ext_bwidth, 1018 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], 1019 pix_colors_focused[Color_border],
1032 pix_colors_focused[Color_border]); 1020 pix_colors_focused[Color_border]);
1033#endif 1021#endif
1034 }
1035 1022
1036 TermWin.parent[0] = top; 1023 TermWin.parent[0] = top;
1037 1024
1038 old_width = szHint.width; 1025 old_width = szHint.width;
1039 old_height = szHint.height; 1026 old_height = szHint.height;
1047 wmHint.flags = InputHint | StateHint | WindowGroupHint; 1034 wmHint.flags = InputHint | StateHint | WindowGroupHint;
1048 wmHint.input = True; 1035 wmHint.input = True;
1049 wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState; 1036 wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState;
1050 wmHint.window_group = top; 1037 wmHint.window_group = top;
1051 1038
1052 XSetWMProperties (disp, top, NULL, NULL, 1039 XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc,
1053 (char **)argv, argc, &szHint, &wmHint, &classHint); 1040 &szHint, &wmHint, &classHint);
1054 1041
1055 /* Enable delete window protocol */ 1042 Atom protocols[] = {
1056 XSetWMProtocols (disp, top, &xa[XA_WM_DELETE_WINDOW], 1); 1043 xa[XA_WM_DELETE_WINDOW],
1044#if ENABLE_EWMH
1045 xa[XA_NET_WM_PING],
1046#endif
1047 };
1057 1048
1058#if ENABLE_FRILLS 1049 XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0]));
1050
1051#if ENABLE_EWMH
1059 long pid = getpid (); 1052 long pid = getpid ();
1060 1053
1061 XChangeProperty (disp, top, 1054 XChangeProperty (disp, top,
1062 xa[XA_NET_WM_PID], XA_CARDINAL, 32, 1055 xa[XA_NET_WM_PID], XA_CARDINAL, 32,
1063 PropModeReplace, (unsigned char *)&pid, 1); 1056 PropModeReplace, (unsigned char *)&pid, 1);
1057
1058 // _NET_WM_WINDOW_TYPE is NORMAL, which is the default
1064#endif 1059#endif
1065 1060
1066 XSelectInput (disp, top, 1061 XSelectInput (disp, top,
1067 KeyPressMask 1062 KeyPressMask
1068#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 1063#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755
1103 attributes.bit_gravity = NorthWestGravity; 1098 attributes.bit_gravity = NorthWestGravity;
1104 XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes); 1099 XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes);
1105 1100
1106 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; 1101 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
1107 1102
1108 pointer_unblank ();
1109
1110#ifdef POINTER_BLANK 1103#ifdef POINTER_BLANK
1111 if (options & Opt_pointerBlank) 1104 if (options & Opt_pointerBlank)
1112 vt_emask |= PointerMotionMask; 1105 vt_emask |= PointerMotionMask;
1113 else 1106 else
1114#endif 1107#endif
1183 // initially we are in unfocused state 1176 // initially we are in unfocused state
1184 if (rs[Rs_fade]) 1177 if (rs[Rs_fade])
1185 pix_colors = pix_colors_unfocused; 1178 pix_colors = pix_colors_unfocused;
1186#endif 1179#endif
1187 1180
1181 pointer_unblank ();
1188 scr_recolour (); 1182 scr_recolour ();
1183
1184#if ENABLE_XEMBED
1185 if (rs[Rs_embed])
1186 {
1187 long info[2] = { 0, XEMBED_MAPPED };
1188
1189 XChangeProperty (disp, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO],
1190 32, PropModeReplace, (unsigned char *)&info, 2);
1191 }
1192#endif
1189} 1193}
1190 1194
1191/* ------------------------------------------------------------------------- * 1195/* ------------------------------------------------------------------------- *
1192 * GET TTY CURRENT STATE * 1196 * GET TTY CURRENT STATE *
1193 * ------------------------------------------------------------------------- */ 1197 * ------------------------------------------------------------------------- */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines