… | |
… | |
590 | |
590 | |
591 | this->locale = rxvt_strdup (this->locale); |
591 | this->locale = rxvt_strdup (this->locale); |
592 | SET_LOCALE (this->locale); |
592 | SET_LOCALE (this->locale); |
593 | mbstate.reset (); |
593 | mbstate.reset (); |
594 | #endif |
594 | #endif |
|
|
595 | |
595 | #if 0 |
596 | #if 0 |
596 | #if HAVE_NL_LANGINFO |
597 | #if HAVE_NL_LANGINFO |
597 | free (codeset); |
|
|
598 | codeset = strdup (nl_langinfo (CODESET)); |
598 | char *codeset = strdup (nl_langinfo (CODESET)); |
599 | enc_utf8 = !strcasecmp (codeset, "UTF-8") |
599 | enc_utf8 = !strcasecmp (codeset, "UTF-8") |
600 | || !strcasecmp (codeset, "UTF8"); |
600 | || !strcasecmp (codeset, "UTF8"); |
|
|
601 | free (codeset); |
601 | #else |
602 | #else |
602 | enc_utf8 = 1; |
603 | enc_utf8 = 0; |
603 | #endif |
604 | #endif |
604 | #endif |
605 | #endif |
605 | } |
606 | } |
606 | |
607 | |
607 | void |
608 | void |
… | |
… | |
610 | #ifdef USE_XIM |
611 | #ifdef USE_XIM |
611 | if (!locale) |
612 | if (!locale) |
612 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
613 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
613 | else |
614 | else |
614 | { |
615 | { |
615 | Atom wmlocale; |
616 | set_string_property (display->atom ("WM_LOCALE_NAME"), locale); |
616 | |
|
|
617 | wmlocale = XInternAtom (display->display, "WM_LOCALE_NAME", False); |
|
|
618 | XChangeProperty (display->display, TermWin.parent[0], wmlocale, |
|
|
619 | XA_STRING, 8, PropModeReplace, |
|
|
620 | (unsigned char *)locale, strlen (locale)); |
|
|
621 | |
617 | |
622 | if (!XSupportsLocale ()) |
618 | if (!XSupportsLocale ()) |
623 | { |
619 | { |
624 | rxvt_warn ("the locale is not supported by Xlib, working without locale support.\n"); |
620 | rxvt_warn ("the locale is not supported by Xlib, working without locale support.\n"); |
625 | return; |
621 | return; |
… | |
… | |
639 | { |
635 | { |
640 | /* |
636 | /* |
641 | * Initialize the command connection. |
637 | * Initialize the command connection. |
642 | * This should be called after the X server connection is established. |
638 | * This should be called after the X server connection is established. |
643 | */ |
639 | */ |
644 | int i; |
|
|
645 | |
|
|
646 | for (i = 0; i < NUM_XA; i++) |
|
|
647 | xa[i] = XInternAtom (display->display, xa_names[i], False); |
|
|
648 | |
|
|
649 | /* Enable delete window protocol */ |
|
|
650 | XSetWMProtocols (display->display, TermWin.parent[0], |
|
|
651 | & (xa[XA_WMDELETEWINDOW]), 1); |
|
|
652 | |
|
|
653 | #ifdef USING_W11LIB |
|
|
654 | /* enable W11 callbacks */ |
|
|
655 | W11AddEventHandler (display->display, rxvt_W11_process_x_event); |
|
|
656 | #endif |
|
|
657 | |
640 | |
658 | #ifdef META8_OPTION |
641 | #ifdef META8_OPTION |
659 | meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); |
642 | meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); |
660 | #endif |
643 | #endif |
661 | |
644 | |
… | |
… | |
913 | XGCValues gcvalue; |
896 | XGCValues gcvalue; |
914 | long vt_emask; |
897 | long vt_emask; |
915 | XSetWindowAttributes attributes; |
898 | XSetWindowAttributes attributes; |
916 | XWindowAttributes gattr; |
899 | XWindowAttributes gattr; |
917 | |
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 | |
918 | if (options & Opt_transparent) |
909 | if (options & Opt_transparent) |
919 | { |
910 | { |
920 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
911 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
921 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
912 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
922 | } |
913 | } |
923 | |
914 | |
924 | #if ENABLE_FRILLS |
915 | #if ENABLE_FRILLS |
925 | if (options & Opt_borderLess) |
916 | if (options & Opt_borderLess) |
926 | { |
917 | { |
927 | prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True); |
918 | prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True); |
|
|
919 | |
928 | if (prop == None) |
920 | if (prop == None) |
929 | { |
921 | { |
930 | /* 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");*/ |
931 | #ifdef PREFER_24BIT |
923 | #ifdef PREFER_24BIT |
932 | attributes.override_redirect = TRUE; |
924 | attributes.override_redirect = TRUE; |
… | |
… | |
947 | |
939 | |
948 | /* grab colors before netscape does */ |
940 | /* grab colors before netscape does */ |
949 | Get_Colours (); |
941 | Get_Colours (); |
950 | |
942 | |
951 | if (!set_fonts ()) |
943 | if (!set_fonts ()) |
952 | 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"); |
953 | |
945 | |
954 | window_calc (0, 0); |
946 | window_calc (0, 0); |
955 | old_width = szHint.width; |
947 | old_width = szHint.width; |
956 | old_height = szHint.height; |
948 | old_height = szHint.height; |
957 | |
949 | |
… | |
… | |
989 | wmHint.window_group = TermWin.parent[0]; |
981 | wmHint.window_group = TermWin.parent[0]; |
990 | |
982 | |
991 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
983 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
992 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
984 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
993 | |
985 | |
|
|
986 | /* Enable delete window protocol */ |
|
|
987 | XSetWMProtocols (display->display, TermWin.parent[0], |
|
|
988 | &xa[XA_WMDELETEWINDOW], 1); |
|
|
989 | |
994 | #if ENABLE_FRILLS |
990 | #if ENABLE_FRILLS |
995 | long pid = getpid (); |
991 | long pid = getpid (); |
|
|
992 | |
996 | XChangeProperty (display->display, TermWin.parent[0], |
993 | XChangeProperty (display->display, TermWin.parent[0], |
997 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
994 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
998 | PropModeReplace, (unsigned char *)&pid, 1); |
995 | PropModeReplace, (unsigned char *)&pid, 1); |
999 | #endif |
996 | #endif |
1000 | |
997 | |
… | |
… | |
1010 | |
1007 | |
1011 | #if ENABLE_FRILLS |
1008 | #if ENABLE_FRILLS |
1012 | if (mwmhints.flags) |
1009 | if (mwmhints.flags) |
1013 | { |
1010 | { |
1014 | prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False); |
1011 | prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False); |
1015 | 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); |
1016 | } |
1014 | } |
1017 | #endif |
1015 | #endif |
1018 | |
1016 | |
1019 | /* 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 */ |
1020 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1018 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |