… | |
… | |
203 | "DndProtocol", |
203 | "DndProtocol", |
204 | "DndSelection", |
204 | "DndSelection", |
205 | #endif |
205 | #endif |
206 | #if ENABLE_XEMBED |
206 | #if ENABLE_XEMBED |
207 | "_XEMBED", |
207 | "_XEMBED", |
|
|
208 | "_XEMBED_INFO", |
208 | #endif |
209 | #endif |
209 | }; |
210 | }; |
210 | |
211 | |
211 | bool |
212 | bool |
212 | rxvt_term::init_vars () |
213 | rxvt_term::init_vars () |
… | |
… | |
929 | #endif |
930 | #endif |
930 | XGCValues gcvalue; |
931 | XGCValues gcvalue; |
931 | long vt_emask; |
932 | long vt_emask; |
932 | XSetWindowAttributes attributes; |
933 | XSetWindowAttributes attributes; |
933 | XWindowAttributes gattr; |
934 | XWindowAttributes gattr; |
934 | Window top; |
935 | Window top, parent; |
935 | dDisp; |
936 | dDisp; |
936 | |
937 | |
937 | #ifdef USING_W11LIB |
938 | #ifdef USING_W11LIB |
938 | /* enable W11 callbacks */ |
939 | /* enable W11 callbacks */ |
939 | W11AddEventHandler (disp, rxvt_W11_process_x_event); |
940 | W11AddEventHandler (disp, rxvt_W11_process_x_event); |
… | |
… | |
977 | Get_Colours (); |
978 | Get_Colours (); |
978 | |
979 | |
979 | if (!set_fonts ()) |
980 | if (!set_fonts ()) |
980 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
981 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
981 | |
982 | |
|
|
983 | parent = DefaultRootWindow (disp); |
|
|
984 | |
982 | #if ENABLE_XEMBED |
985 | #if ENABLE_XEMBED |
983 | if (rs[Rs_embed]) |
986 | if (rs[Rs_embed]) |
984 | { |
987 | { |
985 | XWindowAttributes wattr; |
988 | XWindowAttributes wattr; |
986 | |
989 | |
987 | top = strtol (rs[Rs_embed], 0, 0); |
990 | parent = strtol (rs[Rs_embed], 0, 0); |
988 | |
991 | |
989 | if (!XGetWindowAttributes (disp, top, &wattr)) |
992 | if (!XGetWindowAttributes (disp, parent, &wattr)) |
990 | rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); |
993 | rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); |
991 | |
994 | |
992 | window_calc (wattr.width, wattr.height); |
995 | window_calc (wattr.width, wattr.height); |
|
|
996 | } |
993 | |
997 | |
994 | #if 0 |
998 | #endif |
995 | if (wattr.map_state == IsViewable) |
999 | window_calc (0, 0); |
996 | { |
1000 | |
997 | TermWin.mapped = 1; |
1001 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
998 | refresh_type = FAST_REFRESH; |
1002 | #ifdef PREFER_24BIT |
999 | XClearWindow (disp, top); |
1003 | attributes.background_pixel = pix_colors_focused[Color_border]; |
1000 | // TODO: make XMapNotify-event-code a function and call it |
1004 | attributes.border_pixel = pix_colors_focused[Color_border]; |
1001 | // TODO: how can I detect visibility without unmap/map? |
1005 | attributes.colormap = display->cmap; |
1002 | // TODO: focusin etc. |
1006 | top = XCreateWindow (disp, parent, |
1003 | } |
1007 | szHint.x, szHint.y, |
|
|
1008 | szHint.width, szHint.height, |
|
|
1009 | TermWin.ext_bwidth, |
|
|
1010 | display->depth, InputOutput, |
|
|
1011 | display->visual, |
|
|
1012 | CWColormap | CWBackPixel | CWBorderPixel, &attributes); |
1004 | #else |
1013 | #else |
1005 | // it's easiest just to unmap/map to get all state correctly set-up |
1014 | 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, |
1015 | szHint.x, szHint.y, |
1021 | szHint.width, szHint.height, |
1016 | szHint.width, szHint.height, |
1022 | TermWin.ext_bwidth, |
1017 | 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], |
1018 | pix_colors_focused[Color_border], |
1032 | pix_colors_focused[Color_border]); |
1019 | pix_colors_focused[Color_border]); |
1033 | #endif |
1020 | #endif |
1034 | } |
|
|
1035 | |
1021 | |
1036 | TermWin.parent[0] = top; |
1022 | TermWin.parent[0] = top; |
1037 | |
1023 | |
1038 | old_width = szHint.width; |
1024 | old_width = szHint.width; |
1039 | old_height = szHint.height; |
1025 | old_height = szHint.height; |
… | |
… | |
1185 | |
1171 | |
1186 | pointer_unblank (); |
1172 | pointer_unblank (); |
1187 | scr_recolour (); |
1173 | scr_recolour (); |
1188 | |
1174 | |
1189 | #if ENABLE_XEMBED |
1175 | #if ENABLE_XEMBED |
1190 | // why this is necessary, I don't know, race condition?? |
1176 | if (rs[Rs_embed]) |
1191 | XMoveWindow (disp, TermWin.vt, window_vt_x, window_vt_y); |
1177 | { |
|
|
1178 | long info[2] = { 0, XEMBED_MAPPED }; |
|
|
1179 | |
|
|
1180 | XChangeProperty (disp, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
|
|
1181 | 32, PropModeReplace, (unsigned char *)&info, 2); |
|
|
1182 | } |
1192 | #endif |
1183 | #endif |
1193 | } |
1184 | } |
1194 | |
1185 | |
1195 | /* ------------------------------------------------------------------------- * |
1186 | /* ------------------------------------------------------------------------- * |
1196 | * GET TTY CURRENT STATE * |
1187 | * GET TTY CURRENT STATE * |