… | |
… | |
181 | "MULTIPLE", |
181 | "MULTIPLE", |
182 | "TARGETS", |
182 | "TARGETS", |
183 | "TIMESTAMP", |
183 | "TIMESTAMP", |
184 | "VT_SELECTION", |
184 | "VT_SELECTION", |
185 | "INCR", |
185 | "INCR", |
|
|
186 | "WM_PROTOCOLS", |
186 | "WM_DELETE_WINDOW", |
187 | "WM_DELETE_WINDOW", |
187 | "CLIPBOARD", |
188 | "CLIPBOARD", |
188 | #if ENABLE_FRILLS |
189 | #if ENABLE_FRILLS |
189 | "_NET_WM_PID", |
190 | "_NET_WM_PID", |
190 | "_MOTIF_WM_HINTS", |
191 | "_MOTIF_WM_HINTS", |
… | |
… | |
200 | #endif |
201 | #endif |
201 | #ifdef OFFIX_DND |
202 | #ifdef OFFIX_DND |
202 | "DndProtocol", |
203 | "DndProtocol", |
203 | "DndSelection", |
204 | "DndSelection", |
204 | #endif |
205 | #endif |
|
|
206 | #if ENABLE_XEMBED |
|
|
207 | "_XEMBED", |
|
|
208 | #endif |
205 | }; |
209 | }; |
206 | |
210 | |
207 | bool |
211 | bool |
208 | rxvt_term::init_vars () |
212 | rxvt_term::init_vars () |
209 | { |
213 | { |
… | |
… | |
225 | |
229 | |
226 | MEvent.time = CurrentTime; |
230 | MEvent.time = CurrentTime; |
227 | MEvent.button = AnyButton; |
231 | MEvent.button = AnyButton; |
228 | options = DEFAULT_OPTIONS; |
232 | options = DEFAULT_OPTIONS; |
229 | want_refresh = 1; |
233 | want_refresh = 1; |
230 | cmd_pid = -1; |
|
|
231 | pty.pty = pty.tty = -1; |
|
|
232 | priv_modes = SavedModes = PrivMode_Default; |
234 | priv_modes = SavedModes = PrivMode_Default; |
233 | TermWin.focus = 0; |
235 | TermWin.focus = 0; |
234 | TermWin.ncol = 80; |
236 | TermWin.ncol = 80; |
235 | TermWin.nrow = 24; |
237 | TermWin.nrow = 24; |
236 | TermWin.int_bwidth = INTERNALBORDERWIDTH; |
238 | TermWin.int_bwidth = INTERNALBORDERWIDTH; |
… | |
… | |
673 | if (scrollbar_visible ()) |
675 | if (scrollbar_visible ()) |
674 | { |
676 | { |
675 | priv_modes |= PrivMode_scrollBar; |
677 | priv_modes |= PrivMode_scrollBar; |
676 | SavedModes |= PrivMode_scrollBar; |
678 | SavedModes |= PrivMode_scrollBar; |
677 | } |
679 | } |
|
|
680 | |
678 | if (menubar_visible ()) |
681 | if (menubar_visible ()) |
679 | { |
682 | { |
680 | priv_modes |= PrivMode_menuBar; |
683 | priv_modes |= PrivMode_menuBar; |
681 | SavedModes |= PrivMode_menuBar; |
684 | SavedModes |= PrivMode_menuBar; |
682 | } |
685 | } |
… | |
… | |
974 | Get_Colours (); |
977 | Get_Colours (); |
975 | |
978 | |
976 | if (!set_fonts ()) |
979 | if (!set_fonts ()) |
977 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
980 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
978 | |
981 | |
979 | #if ENABLE_FRILLS |
982 | #if ENABLE_XEMBED |
980 | if (rs[Rs_embed]) |
983 | if (rs[Rs_embed]) |
981 | { |
984 | { |
|
|
985 | XWindowAttributes wattr; |
|
|
986 | |
982 | top = strtol (rs[Rs_embed], 0, 0); |
987 | top = strtol (rs[Rs_embed], 0, 0); |
983 | |
988 | |
984 | XWindowAttributes wattr; |
|
|
985 | XGetWindowAttributes (disp, top, &wattr); |
989 | if (!XGetWindowAttributes (disp, top, &wattr)) |
|
|
990 | rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); |
986 | |
991 | |
987 | window_calc (wattr.width, wattr.height); |
992 | window_calc (wattr.width, wattr.height); |
988 | |
993 | |
989 | #if 0 |
994 | #if 0 |
990 | if (wattr.map_state == IsViewable) |
995 | if (wattr.map_state == IsViewable) |
991 | { |
996 | { |
992 | TermWin.mapped = 1; |
997 | TermWin.mapped = 1; |
993 | refresh_type = FAST_REFRESH; |
998 | refresh_type = FAST_REFRESH; |
994 | XClearWindow (disp, top); |
999 | XClearWindow (disp, top); |
995 | // TODO: make XMapNotify-event-code a function and call it |
1000 | // TODO: make XMapNotify-event-code a function and call it |
996 | // TODO: how can I detetc visibility without unmpa/map? |
1001 | // TODO: how can I detect visibility without unmap/map? |
997 | // TODO: focusin etc. |
1002 | // TODO: focusin etc. |
998 | } |
1003 | } |
999 | #else |
1004 | #else |
1000 | // it'S easiets just to unmap/map to get all state correctly set-up |
1005 | // it's easiest just to unmap/map to get all state correctly set-up |
1001 | XUnmapWindow (disp, top); |
1006 | XUnmapWindow (disp, top); |
1002 | #endif |
1007 | #endif |
1003 | } |
1008 | } |
1004 | else |
1009 | else |
1005 | #endif |
1010 | #endif |
… | |
… | |
1010 | #ifdef PREFER_24BIT |
1015 | #ifdef PREFER_24BIT |
1011 | attributes.background_pixel = pix_colors_focused[Color_border]; |
1016 | attributes.background_pixel = pix_colors_focused[Color_border]; |
1012 | attributes.border_pixel = pix_colors_focused[Color_border]; |
1017 | attributes.border_pixel = pix_colors_focused[Color_border]; |
1013 | attributes.colormap = display->cmap; |
1018 | attributes.colormap = display->cmap; |
1014 | top = XCreateWindow (disp, DefaultRootWindow (disp), |
1019 | top = XCreateWindow (disp, DefaultRootWindow (disp), |
1015 | szHint.x, szHint.y, |
1020 | szHint.x, szHint.y, |
1016 | szHint.width, szHint.height, |
1021 | szHint.width, szHint.height, |
1017 | TermWin.ext_bwidth, |
1022 | TermWin.ext_bwidth, |
1018 | display->depth, InputOutput, |
1023 | display->depth, InputOutput, |
1019 | display->visual, |
1024 | display->visual, |
1020 | CWColormap | CWBackPixel | CWBorderPixel, &attributes); |
1025 | CWColormap | CWBackPixel | CWBorderPixel, &attributes); |
1021 | #else |
1026 | #else |
1022 | top = XCreateSimpleWindow (disp, DefaultRootWindow (disp), |
1027 | top = XCreateSimpleWindow (disp, DefaultRootWindow (disp), |
1023 | szHint.x, szHint.y, |
1028 | szHint.x, szHint.y, |
1024 | szHint.width, szHint.height, |
1029 | szHint.width, szHint.height, |
1025 | TermWin.ext_bwidth, |
1030 | TermWin.ext_bwidth, |
1026 | pix_colors_focused[Color_border], |
1031 | pix_colors_focused[Color_border], |
1027 | pix_colors_focused[Color_border]); |
1032 | pix_colors_focused[Color_border]); |
1028 | #endif |
1033 | #endif |
1029 | } |
1034 | } |
1030 | |
1035 | |
1031 | TermWin.parent[0] = top; |
1036 | TermWin.parent[0] = top; |
1032 | |
1037 | |
… | |
… | |
1046 | |
1051 | |
1047 | XSetWMProperties (disp, top, NULL, NULL, |
1052 | XSetWMProperties (disp, top, NULL, NULL, |
1048 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
1053 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
1049 | |
1054 | |
1050 | /* Enable delete window protocol */ |
1055 | /* Enable delete window protocol */ |
1051 | XSetWMProtocols (disp, top, &xa[XA_WMDELETEWINDOW], 1); |
1056 | XSetWMProtocols (disp, top, &xa[XA_WM_DELETE_WINDOW], 1); |
1052 | |
1057 | |
1053 | #if ENABLE_FRILLS |
1058 | #if ENABLE_FRILLS |
1054 | long pid = getpid (); |
1059 | long pid = getpid (); |
1055 | |
1060 | |
1056 | XChangeProperty (disp, top, |
1061 | XChangeProperty (disp, top, |
… | |
… | |
1062 | KeyPressMask |
1067 | KeyPressMask |
1063 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 |
1068 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 |
1064 | | KeyReleaseMask |
1069 | | KeyReleaseMask |
1065 | #endif |
1070 | #endif |
1066 | | FocusChangeMask | VisibilityChangeMask |
1071 | | FocusChangeMask | VisibilityChangeMask |
1067 | | ExposureMask |
|
|
1068 | | StructureNotifyMask); |
1072 | | ExposureMask | StructureNotifyMask); |
|
|
1073 | |
1069 | termwin_ev.start (display, top); |
1074 | termwin_ev.start (display, top); |
1070 | |
1075 | |
1071 | #if ENABLE_FRILLS |
1076 | #if ENABLE_FRILLS |
1072 | if (mwmhints.flags) |
1077 | if (mwmhints.flags) |
1073 | XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1078 | XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
… | |
… | |
1098 | attributes.bit_gravity = NorthWestGravity; |
1103 | attributes.bit_gravity = NorthWestGravity; |
1099 | XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes); |
1104 | XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes); |
1100 | |
1105 | |
1101 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1106 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1102 | |
1107 | |
1103 | pointer_unblank (); |
|
|
1104 | |
|
|
1105 | #ifdef POINTER_BLANK |
1108 | #ifdef POINTER_BLANK |
1106 | if (options & Opt_pointerBlank) |
1109 | if (options & Opt_pointerBlank) |
1107 | vt_emask |= PointerMotionMask; |
1110 | vt_emask |= PointerMotionMask; |
1108 | else |
1111 | else |
1109 | #endif |
1112 | #endif |
… | |
… | |
1178 | // initially we are in unfocused state |
1181 | // initially we are in unfocused state |
1179 | if (rs[Rs_fade]) |
1182 | if (rs[Rs_fade]) |
1180 | pix_colors = pix_colors_unfocused; |
1183 | pix_colors = pix_colors_unfocused; |
1181 | #endif |
1184 | #endif |
1182 | |
1185 | |
|
|
1186 | pointer_unblank (); |
1183 | scr_recolour (); |
1187 | scr_recolour (); |
|
|
1188 | |
|
|
1189 | #if ENABLE_XEMBED |
|
|
1190 | // why this is necessary, I don't know, race condition?? |
|
|
1191 | XMoveWindow (disp, TermWin.vt, window_vt_x, window_vt_y); |
|
|
1192 | #endif |
1184 | } |
1193 | } |
1185 | |
1194 | |
1186 | /* ------------------------------------------------------------------------- * |
1195 | /* ------------------------------------------------------------------------- * |
1187 | * GET TTY CURRENT STATE * |
1196 | * GET TTY CURRENT STATE * |
1188 | * ------------------------------------------------------------------------- */ |
1197 | * ------------------------------------------------------------------------- */ |
… | |
… | |
1417 | * the slave. |
1426 | * the slave. |
1418 | */ |
1427 | */ |
1419 | void |
1428 | void |
1420 | rxvt_term::run_command (const char *const *argv) |
1429 | rxvt_term::run_command (const char *const *argv) |
1421 | { |
1430 | { |
|
|
1431 | #if ENABLE_FRILLS |
|
|
1432 | if (rs[Rs_pty_fd]) |
|
|
1433 | { |
|
|
1434 | pty.pty = atoi (rs[Rs_pty_fd]); |
|
|
1435 | fcntl (pty.pty, F_SETFL, O_NONBLOCK); |
|
|
1436 | } |
|
|
1437 | else |
|
|
1438 | #endif |
1422 | if (!pty.get ()) |
1439 | if (!pty.get ()) |
1423 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
1440 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
1424 | |
1441 | |
1425 | pty.set_utf8_mode (enc_utf8); |
1442 | pty.set_utf8_mode (enc_utf8); |
1426 | |
1443 | |
1427 | /* set initial window size */ |
1444 | /* set initial window size */ |
1428 | tt_winch (); |
1445 | tt_winch (); |
… | |
… | |
1438 | #endif |
1455 | #endif |
1439 | er = -1; |
1456 | er = -1; |
1440 | |
1457 | |
1441 | rxvt_get_ttymode (&tio, er); |
1458 | rxvt_get_ttymode (&tio, er); |
1442 | |
1459 | |
|
|
1460 | #if ENABLE_FRILLS |
|
|
1461 | if (rs[Rs_pty_fd]) |
|
|
1462 | return; |
|
|
1463 | #endif |
|
|
1464 | |
1443 | sw_chld.start (SIGCHLD); |
1465 | sw_chld.start (SIGCHLD); |
1444 | |
1466 | |
1445 | #ifndef __QNX__ |
1467 | #ifndef __QNX__ |
1446 | /* spin off the command interpreter */ |
1468 | /* spin off the command interpreter */ |
1447 | switch (cmd_pid = fork ()) |
1469 | switch (cmd_pid = fork ()) |
1448 | { |
1470 | { |
1449 | case -1: |
1471 | case -1: |
|
|
1472 | { |
|
|
1473 | cmd_pid = 0; |
1450 | rxvt_fatal ("can't fork, aborting.\n"); |
1474 | rxvt_fatal ("can't fork, aborting.\n"); |
|
|
1475 | } |
1451 | case 0: |
1476 | case 0: |
1452 | init_env (); |
1477 | init_env (); |
1453 | |
1478 | |
1454 | if (!pty.make_controlling_tty ()) |
1479 | if (!pty.make_controlling_tty ()) |
1455 | fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); |
1480 | fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); |