… | |
… | |
191 | }; |
191 | }; |
192 | |
192 | |
193 | bool |
193 | bool |
194 | rxvt_term::init_vars () |
194 | rxvt_term::init_vars () |
195 | { |
195 | { |
|
|
196 | sw_term.start (SIGTERM); |
|
|
197 | |
196 | pix_colors_focused = new rxvt_color [TOTAL_COLORS]; |
198 | pix_colors_focused = new rxvt_color [TOTAL_COLORS]; |
197 | #ifdef OFF_FOCUS_FADING |
199 | #ifdef OFF_FOCUS_FADING |
198 | pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; |
200 | pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; |
199 | #endif |
201 | #endif |
200 | pix_colors = pix_colors_focused; |
202 | pix_colors = pix_colors_focused; |
… | |
… | |
588 | |
590 | |
589 | this->locale = rxvt_strdup (this->locale); |
591 | this->locale = rxvt_strdup (this->locale); |
590 | SET_LOCALE (this->locale); |
592 | SET_LOCALE (this->locale); |
591 | mbstate.reset (); |
593 | mbstate.reset (); |
592 | #endif |
594 | #endif |
|
|
595 | |
593 | #if 0 |
596 | #if 0 |
594 | #if HAVE_NL_LANGINFO |
597 | #if HAVE_NL_LANGINFO |
595 | free (codeset); |
|
|
596 | codeset = strdup (nl_langinfo (CODESET)); |
598 | char *codeset = strdup (nl_langinfo (CODESET)); |
597 | enc_utf8 = !strcasecmp (codeset, "UTF-8") |
599 | enc_utf8 = !strcasecmp (codeset, "UTF-8") |
598 | || !strcasecmp (codeset, "UTF8"); |
600 | || !strcasecmp (codeset, "UTF8"); |
|
|
601 | free (codeset); |
599 | #else |
602 | #else |
600 | enc_utf8 = 1; |
603 | enc_utf8 = 0; |
601 | #endif |
604 | #endif |
602 | #endif |
605 | #endif |
603 | } |
606 | } |
604 | |
607 | |
605 | void |
608 | void |
… | |
… | |
608 | #ifdef USE_XIM |
611 | #ifdef USE_XIM |
609 | if (!locale) |
612 | if (!locale) |
610 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
613 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
611 | else |
614 | else |
612 | { |
615 | { |
613 | Atom wmlocale; |
616 | set_string_property (display->atom ("WM_LOCALE_NAME"), locale); |
614 | |
|
|
615 | wmlocale = XInternAtom (display->display, "WM_LOCALE_NAME", False); |
|
|
616 | XChangeProperty (display->display, TermWin.parent[0], wmlocale, |
|
|
617 | XA_STRING, 8, PropModeReplace, |
|
|
618 | (unsigned char *)locale, strlen (locale)); |
|
|
619 | |
617 | |
620 | if (!XSupportsLocale ()) |
618 | if (!XSupportsLocale ()) |
621 | { |
619 | { |
622 | rxvt_warn ("the locale is not supported by Xlib, working withotu locale support.\n"); |
620 | rxvt_warn ("the locale is not supported by Xlib, working without locale support.\n"); |
623 | return; |
621 | return; |
624 | } |
622 | } |
625 | |
623 | |
626 | im_ev.start (display); |
624 | im_ev.start (display); |
627 | |
625 | |
… | |
… | |
637 | { |
635 | { |
638 | /* |
636 | /* |
639 | * Initialize the command connection. |
637 | * Initialize the command connection. |
640 | * This should be called after the X server connection is established. |
638 | * This should be called after the X server connection is established. |
641 | */ |
639 | */ |
642 | int i; |
|
|
643 | |
|
|
644 | for (i = 0; i < NUM_XA; i++) |
|
|
645 | xa[i] = XInternAtom (display->display, xa_names[i], False); |
|
|
646 | |
|
|
647 | /* Enable delete window protocol */ |
|
|
648 | XSetWMProtocols (display->display, TermWin.parent[0], |
|
|
649 | & (xa[XA_WMDELETEWINDOW]), 1); |
|
|
650 | |
|
|
651 | #ifdef USING_W11LIB |
|
|
652 | /* enable W11 callbacks */ |
|
|
653 | W11AddEventHandler (display->display, rxvt_W11_process_x_event); |
|
|
654 | #endif |
|
|
655 | |
640 | |
656 | #ifdef META8_OPTION |
641 | #ifdef META8_OPTION |
657 | meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); |
642 | meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); |
658 | #endif |
643 | #endif |
659 | |
644 | |
… | |
… | |
911 | XGCValues gcvalue; |
896 | XGCValues gcvalue; |
912 | long vt_emask; |
897 | long vt_emask; |
913 | XSetWindowAttributes attributes; |
898 | XSetWindowAttributes attributes; |
914 | XWindowAttributes gattr; |
899 | XWindowAttributes gattr; |
915 | |
900 | |
|
|
901 | for (int i = 0; i < NUM_XA; i++) |
|
|
902 | xa[i] = XInternAtom (display->display, xa_names[i], False); |
|
|
903 | |
|
|
904 | #ifdef USING_W11LIB |
|
|
905 | /* enable W11 callbacks */ |
|
|
906 | W11AddEventHandler (display->display, rxvt_W11_process_x_event); |
|
|
907 | #endif |
|
|
908 | |
916 | if (options & Opt_transparent) |
909 | if (options & Opt_transparent) |
917 | { |
910 | { |
918 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
911 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
919 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
912 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
920 | } |
913 | } |
921 | |
914 | |
922 | #if ENABLE_FRILLS |
915 | #if ENABLE_FRILLS |
923 | if (options & Opt_borderLess) |
916 | if (options & Opt_borderLess) |
924 | { |
917 | { |
925 | prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True); |
918 | prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True); |
|
|
919 | |
926 | if (prop == None) |
920 | if (prop == None) |
927 | { |
921 | { |
928 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
922 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
929 | #ifdef PREFER_24BIT |
923 | #ifdef PREFER_24BIT |
930 | attributes.override_redirect = TRUE; |
924 | attributes.override_redirect = TRUE; |
… | |
… | |
945 | |
939 | |
946 | /* grab colors before netscape does */ |
940 | /* grab colors before netscape does */ |
947 | Get_Colours (); |
941 | Get_Colours (); |
948 | |
942 | |
949 | if (!set_fonts ()) |
943 | if (!set_fonts ()) |
950 | rxvt_fatal ("unable to load base fontset, please specify one using -fn, aborting.\n"); |
944 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
951 | |
945 | |
952 | window_calc (0, 0); |
946 | window_calc (0, 0); |
953 | old_width = szHint.width; |
947 | old_width = szHint.width; |
954 | old_height = szHint.height; |
948 | old_height = szHint.height; |
955 | |
949 | |
… | |
… | |
987 | wmHint.window_group = TermWin.parent[0]; |
981 | wmHint.window_group = TermWin.parent[0]; |
988 | |
982 | |
989 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
983 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
990 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
984 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
991 | |
985 | |
|
|
986 | /* Enable delete window protocol */ |
|
|
987 | XSetWMProtocols (display->display, TermWin.parent[0], |
|
|
988 | &xa[XA_WMDELETEWINDOW], 1); |
|
|
989 | |
992 | #if ENABLE_FRILLS |
990 | #if ENABLE_FRILLS |
993 | long pid = getpid (); |
991 | long pid = getpid (); |
|
|
992 | |
994 | XChangeProperty (display->display, TermWin.parent[0], |
993 | XChangeProperty (display->display, TermWin.parent[0], |
995 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
994 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
996 | PropModeReplace, (unsigned char *)&pid, 1); |
995 | PropModeReplace, (unsigned char *)&pid, 1); |
997 | #endif |
996 | #endif |
998 | |
997 | |
… | |
… | |
1008 | |
1007 | |
1009 | #if ENABLE_FRILLS |
1008 | #if ENABLE_FRILLS |
1010 | if (mwmhints.flags) |
1009 | if (mwmhints.flags) |
1011 | { |
1010 | { |
1012 | prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False); |
1011 | prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False); |
1013 | XChangeProperty (display->display, TermWin.parent[0], prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS); |
1012 | XChangeProperty (display->display, TermWin.parent[0], prop, prop, 32, |
|
|
1013 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
1014 | } |
1014 | } |
1015 | #endif |
1015 | #endif |
1016 | |
1016 | |
1017 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1017 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1018 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1018 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
… | |
… | |
1389 | |
1389 | |
1390 | rxvt_get_ttymode (&tio, er); |
1390 | rxvt_get_ttymode (&tio, er); |
1391 | |
1391 | |
1392 | /* set initial window size */ |
1392 | /* set initial window size */ |
1393 | tt_winch (); |
1393 | tt_winch (); |
|
|
1394 | |
|
|
1395 | sw_chld.start (SIGCHLD); |
1394 | |
1396 | |
1395 | #ifndef __QNX__ |
1397 | #ifndef __QNX__ |
1396 | /* spin off the command interpreter */ |
1398 | /* spin off the command interpreter */ |
1397 | switch (cmd_pid = fork ()) |
1399 | switch (cmd_pid = fork ()) |
1398 | { |
1400 | { |