… | |
… | |
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 detetc visibility without unmpa/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 easiets 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; |
… | |
… | |
1047 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
1033 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
1048 | wmHint.input = True; |
1034 | wmHint.input = True; |
1049 | wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState; |
1035 | wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState; |
1050 | wmHint.window_group = top; |
1036 | wmHint.window_group = top; |
1051 | |
1037 | |
1052 | XSetWMProperties (disp, top, NULL, NULL, |
1038 | XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, |
1053 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
1039 | &szHint, &wmHint, &classHint); |
1054 | |
1040 | |
1055 | /* Enable delete window protocol */ |
1041 | /* Enable delete window protocol */ |
1056 | XSetWMProtocols (disp, top, &xa[XA_WM_DELETE_WINDOW], 1); |
1042 | XSetWMProtocols (disp, top, &xa[XA_WM_DELETE_WINDOW], 1); |
1057 | |
1043 | |
1058 | #if ENABLE_FRILLS |
1044 | #if ENABLE_FRILLS |
… | |
… | |
1103 | attributes.bit_gravity = NorthWestGravity; |
1089 | attributes.bit_gravity = NorthWestGravity; |
1104 | XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes); |
1090 | XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes); |
1105 | |
1091 | |
1106 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1092 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1107 | |
1093 | |
1108 | pointer_unblank (); |
|
|
1109 | |
|
|
1110 | #ifdef POINTER_BLANK |
1094 | #ifdef POINTER_BLANK |
1111 | if (options & Opt_pointerBlank) |
1095 | if (options & Opt_pointerBlank) |
1112 | vt_emask |= PointerMotionMask; |
1096 | vt_emask |= PointerMotionMask; |
1113 | else |
1097 | else |
1114 | #endif |
1098 | #endif |
… | |
… | |
1183 | // initially we are in unfocused state |
1167 | // initially we are in unfocused state |
1184 | if (rs[Rs_fade]) |
1168 | if (rs[Rs_fade]) |
1185 | pix_colors = pix_colors_unfocused; |
1169 | pix_colors = pix_colors_unfocused; |
1186 | #endif |
1170 | #endif |
1187 | |
1171 | |
|
|
1172 | pointer_unblank (); |
1188 | scr_recolour (); |
1173 | scr_recolour (); |
|
|
1174 | |
|
|
1175 | #if ENABLE_XEMBED |
|
|
1176 | if (rs[Rs_embed]) |
|
|
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 | } |
|
|
1183 | #endif |
1189 | } |
1184 | } |
1190 | |
1185 | |
1191 | /* ------------------------------------------------------------------------- * |
1186 | /* ------------------------------------------------------------------------- * |
1192 | * GET TTY CURRENT STATE * |
1187 | * GET TTY CURRENT STATE * |
1193 | * ------------------------------------------------------------------------- */ |
1188 | * ------------------------------------------------------------------------- */ |