ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/init.C
(Generate patch)

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.90 by root, Wed Aug 25 03:47:20 2004 UTC vs.
Revision 1.98 by root, Wed Dec 15 00:53:23 2004 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines