… | |
… | |
167 | #if TINTING |
167 | #if TINTING |
168 | NULL, |
168 | NULL, |
169 | #endif |
169 | #endif |
170 | }; |
170 | }; |
171 | |
171 | |
172 | const char *const xa_names[NUM_XA] = |
172 | const char *const xa_names[] = |
173 | { |
173 | { |
174 | "TEXT", |
174 | "TEXT", |
175 | "COMPOUND_TEXT", |
175 | "COMPOUND_TEXT", |
176 | "UTF8_STRING", |
176 | "UTF8_STRING", |
177 | "MULTIPLE", |
177 | "MULTIPLE", |
178 | "TARGETS", |
178 | "TARGETS", |
179 | "TIMESTAMP", |
179 | "TIMESTAMP", |
180 | "VT_SELECTION", |
180 | "VT_SELECTION", |
181 | "INCR", |
181 | "INCR", |
182 | "WM_DELETE_WINDOW", |
182 | "WM_DELETE_WINDOW", |
|
|
183 | "CLIPBOARD", |
|
|
184 | #if ENABLE_FRILLS |
|
|
185 | "_NET_WM_PID", |
|
|
186 | "_MOTIF_WM_HINTS", |
|
|
187 | "_NET_WM_NAME", |
|
|
188 | "_NET_WM_ICON_NAME", |
|
|
189 | #endif |
|
|
190 | #if USE_XIM |
|
|
191 | "WM_LOCALE_NAME", |
|
|
192 | #endif |
183 | #ifdef TRANSPARENT |
193 | #ifdef TRANSPARENT |
184 | "_XROOTPMAP_ID", |
194 | "_XROOTPMAP_ID", |
|
|
195 | "_XSETROOT_ID", |
185 | #endif |
196 | #endif |
186 | #ifdef OFFIX_DND |
197 | #ifdef OFFIX_DND |
187 | "DndProtocol", |
198 | "DndProtocol", |
188 | "DndSelection", |
199 | "DndSelection", |
189 | #endif |
200 | #endif |
190 | "CLIPBOARD" |
|
|
191 | }; |
201 | }; |
192 | |
202 | |
193 | bool |
203 | bool |
194 | rxvt_term::init_vars () |
204 | rxvt_term::init_vars () |
195 | { |
205 | { |
|
|
206 | sw_term.start (SIGTERM); |
|
|
207 | |
196 | pix_colors_focused = new rxvt_color [TOTAL_COLORS]; |
208 | pix_colors_focused = new rxvt_color [TOTAL_COLORS]; |
197 | #ifdef OFF_FOCUS_FADING |
209 | #ifdef OFF_FOCUS_FADING |
198 | pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; |
210 | pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; |
199 | #endif |
211 | #endif |
200 | pix_colors = pix_colors_focused; |
212 | pix_colors = pix_colors_focused; |
… | |
… | |
588 | |
600 | |
589 | this->locale = rxvt_strdup (this->locale); |
601 | this->locale = rxvt_strdup (this->locale); |
590 | SET_LOCALE (this->locale); |
602 | SET_LOCALE (this->locale); |
591 | mbstate.reset (); |
603 | mbstate.reset (); |
592 | #endif |
604 | #endif |
|
|
605 | |
593 | #if 0 |
606 | #if 0 |
594 | #if HAVE_NL_LANGINFO |
607 | #if HAVE_NL_LANGINFO |
595 | free (codeset); |
|
|
596 | codeset = strdup (nl_langinfo (CODESET)); |
608 | char *codeset = strdup (nl_langinfo (CODESET)); |
597 | enc_utf8 = !strcasecmp (codeset, "UTF-8") |
609 | enc_utf8 = !strcasecmp (codeset, "UTF-8") |
598 | || !strcasecmp (codeset, "UTF8"); |
610 | || !strcasecmp (codeset, "UTF8"); |
|
|
611 | free (codeset); |
599 | #else |
612 | #else |
600 | enc_utf8 = 1; |
613 | enc_utf8 = 0; |
601 | #endif |
614 | #endif |
602 | #endif |
615 | #endif |
603 | } |
616 | } |
604 | |
617 | |
605 | void |
618 | void |
… | |
… | |
608 | #ifdef USE_XIM |
621 | #ifdef USE_XIM |
609 | if (!locale) |
622 | if (!locale) |
610 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
623 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
611 | else |
624 | else |
612 | { |
625 | { |
613 | Atom wmlocale; |
626 | set_string_property (xa[XA_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 | |
627 | |
620 | if (!XSupportsLocale ()) |
628 | if (!XSupportsLocale ()) |
621 | { |
629 | { |
622 | rxvt_warn ("the locale is not supported by Xlib, working withotu locale support.\n"); |
630 | rxvt_warn ("the locale is not supported by Xlib, working without locale support.\n"); |
623 | return; |
631 | return; |
624 | } |
632 | } |
625 | |
633 | |
626 | im_ev.start (display); |
634 | im_ev.start (display); |
627 | |
635 | |
… | |
… | |
637 | { |
645 | { |
638 | /* |
646 | /* |
639 | * Initialize the command connection. |
647 | * Initialize the command connection. |
640 | * This should be called after the X server connection is established. |
648 | * This should be called after the X server connection is established. |
641 | */ |
649 | */ |
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 | |
650 | |
656 | #ifdef META8_OPTION |
651 | #ifdef META8_OPTION |
657 | meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); |
652 | meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); |
658 | #endif |
653 | #endif |
659 | |
654 | |
… | |
… | |
911 | XGCValues gcvalue; |
906 | XGCValues gcvalue; |
912 | long vt_emask; |
907 | long vt_emask; |
913 | XSetWindowAttributes attributes; |
908 | XSetWindowAttributes attributes; |
914 | XWindowAttributes gattr; |
909 | XWindowAttributes gattr; |
915 | |
910 | |
|
|
911 | #ifdef USING_W11LIB |
|
|
912 | /* enable W11 callbacks */ |
|
|
913 | W11AddEventHandler (display->display, rxvt_W11_process_x_event); |
|
|
914 | #endif |
|
|
915 | |
|
|
916 | assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); |
|
|
917 | XInternAtoms (display->display, (char **)xa_names, NUM_XA, False, xa); |
|
|
918 | |
916 | if (options & Opt_transparent) |
919 | if (options & Opt_transparent) |
917 | { |
920 | { |
918 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
921 | XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); |
919 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
922 | display->depth = gattr.depth; // doh //TODO, per-term not per-display? |
920 | } |
923 | } |
921 | |
924 | |
922 | #if ENABLE_FRILLS |
925 | #if ENABLE_FRILLS |
923 | if (options & Opt_borderLess) |
926 | if (options & Opt_borderLess) |
924 | { |
927 | { |
925 | prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True); |
928 | prop = XInternAtom(display->display, "_MOTIF_WM_INFO", True); |
|
|
929 | |
926 | if (prop == None) |
930 | if (prop == None) |
927 | { |
931 | { |
928 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
932 | /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ |
929 | #ifdef PREFER_24BIT |
933 | #ifdef PREFER_24BIT |
930 | attributes.override_redirect = TRUE; |
934 | attributes.override_redirect = TRUE; |
… | |
… | |
945 | |
949 | |
946 | /* grab colors before netscape does */ |
950 | /* grab colors before netscape does */ |
947 | Get_Colours (); |
951 | Get_Colours (); |
948 | |
952 | |
949 | if (!set_fonts ()) |
953 | if (!set_fonts ()) |
950 | rxvt_fatal ("unable to load base fontset, please specify one using -fn, aborting.\n"); |
954 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
951 | |
955 | |
952 | window_calc (0, 0); |
956 | window_calc (0, 0); |
953 | old_width = szHint.width; |
957 | old_width = szHint.width; |
954 | old_height = szHint.height; |
958 | old_height = szHint.height; |
955 | |
959 | |
… | |
… | |
987 | wmHint.window_group = TermWin.parent[0]; |
991 | wmHint.window_group = TermWin.parent[0]; |
988 | |
992 | |
989 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
993 | XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, |
990 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
994 | (char **)argv, argc, &szHint, &wmHint, &classHint); |
991 | |
995 | |
|
|
996 | /* Enable delete window protocol */ |
|
|
997 | XSetWMProtocols (display->display, TermWin.parent[0], |
|
|
998 | &xa[XA_WMDELETEWINDOW], 1); |
|
|
999 | |
992 | #if ENABLE_FRILLS |
1000 | #if ENABLE_FRILLS |
993 | long pid = getpid (); |
1001 | long pid = getpid (); |
|
|
1002 | |
994 | XChangeProperty (display->display, TermWin.parent[0], |
1003 | XChangeProperty (display->display, TermWin.parent[0], |
995 | display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, |
1004 | xa[XA_NET_WM_PID], XA_CARDINAL, 32, |
996 | PropModeReplace, (unsigned char *)&pid, 1); |
1005 | PropModeReplace, (unsigned char *)&pid, 1); |
997 | #endif |
1006 | #endif |
998 | |
1007 | |
999 | XSelectInput (display->display, TermWin.parent[0], |
1008 | XSelectInput (display->display, TermWin.parent[0], |
1000 | KeyPressMask |
1009 | KeyPressMask |
… | |
… | |
1006 | | StructureNotifyMask); |
1015 | | StructureNotifyMask); |
1007 | termwin_ev.start (display, TermWin.parent[0]); |
1016 | termwin_ev.start (display, TermWin.parent[0]); |
1008 | |
1017 | |
1009 | #if ENABLE_FRILLS |
1018 | #if ENABLE_FRILLS |
1010 | if (mwmhints.flags) |
1019 | if (mwmhints.flags) |
1011 | { |
1020 | XChangeProperty (display->display, TermWin.parent[0], xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1012 | prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False); |
1021 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
1013 | XChangeProperty (display->display, TermWin.parent[0], prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS); |
|
|
1014 | } |
|
|
1015 | #endif |
1022 | #endif |
1016 | |
1023 | |
1017 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1024 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1018 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1025 | TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); |
1019 | |
1026 | |
… | |
… | |
1389 | |
1396 | |
1390 | rxvt_get_ttymode (&tio, er); |
1397 | rxvt_get_ttymode (&tio, er); |
1391 | |
1398 | |
1392 | /* set initial window size */ |
1399 | /* set initial window size */ |
1393 | tt_winch (); |
1400 | tt_winch (); |
|
|
1401 | |
|
|
1402 | sw_chld.start (SIGCHLD); |
1394 | |
1403 | |
1395 | #ifndef __QNX__ |
1404 | #ifndef __QNX__ |
1396 | /* spin off the command interpreter */ |
1405 | /* spin off the command interpreter */ |
1397 | switch (cmd_pid = fork ()) |
1406 | switch (cmd_pid = fork ()) |
1398 | { |
1407 | { |