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.93 by root, Sun Oct 24 14:02:44 2004 UTC vs.
Revision 1.97 by root, Wed Dec 15 00:12:58 2004 UTC

167#if TINTING 167#if TINTING
168 NULL, 168 NULL,
169#endif 169#endif
170 }; 170 };
171 171
172const char *const xa_names[NUM_XA] = 172const 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
193bool 203bool
194rxvt_term::init_vars () 204rxvt_term::init_vars ()
195{ 205{
590 600
591 this->locale = rxvt_strdup (this->locale); 601 this->locale = rxvt_strdup (this->locale);
592 SET_LOCALE (this->locale); 602 SET_LOCALE (this->locale);
593 mbstate.reset (); 603 mbstate.reset ();
594#endif 604#endif
605
595#if 0 606#if 0
596#if HAVE_NL_LANGINFO 607#if HAVE_NL_LANGINFO
597 free (codeset);
598 codeset = strdup (nl_langinfo (CODESET)); 608 char *codeset = strdup (nl_langinfo (CODESET));
599 enc_utf8 = !strcasecmp (codeset, "UTF-8") 609 enc_utf8 = !strcasecmp (codeset, "UTF-8")
600 || !strcasecmp (codeset, "UTF8"); 610 || !strcasecmp (codeset, "UTF8");
611 free (codeset);
601#else 612#else
602 enc_utf8 = 1; 613 enc_utf8 = 0;
603#endif 614#endif
604#endif 615#endif
605} 616}
606 617
607void 618void
610#ifdef USE_XIM 621#ifdef USE_XIM
611 if (!locale) 622 if (!locale)
612 rxvt_warn ("setting locale failed, working without locale support.\n"); 623 rxvt_warn ("setting locale failed, working without locale support.\n");
613 else 624 else
614 { 625 {
615 Atom wmlocale; 626 set_string_property (xa[XA_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 627
622 if (!XSupportsLocale ()) 628 if (!XSupportsLocale ())
623 { 629 {
624 rxvt_warn ("the locale is not supported by Xlib, working without locale support.\n"); 630 rxvt_warn ("the locale is not supported by Xlib, working without locale support.\n");
625 return; 631 return;
639{ 645{
640 /* 646 /*
641 * Initialize the command connection. 647 * Initialize the command connection.
642 * This should be called after the X server connection is established. 648 * This should be called after the X server connection is established.
643 */ 649 */
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 650
658#ifdef META8_OPTION 651#ifdef META8_OPTION
659 meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); 652 meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC);
660#endif 653#endif
661 654
913 XGCValues gcvalue; 906 XGCValues gcvalue;
914 long vt_emask; 907 long vt_emask;
915 XSetWindowAttributes attributes; 908 XSetWindowAttributes attributes;
916 XWindowAttributes gattr; 909 XWindowAttributes gattr;
917 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
918 if (options & Opt_transparent) 919 if (options & Opt_transparent)
919 { 920 {
920 XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); 921 XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr);
921 display->depth = gattr.depth; // doh //TODO, per-term not per-display? 922 display->depth = gattr.depth; // doh //TODO, per-term not per-display?
922 } 923 }
948 949
949 /* grab colors before netscape does */ 950 /* grab colors before netscape does */
950 Get_Colours (); 951 Get_Colours ();
951 952
952 if (!set_fonts ()) 953 if (!set_fonts ())
953 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");
954 955
955 window_calc (0, 0); 956 window_calc (0, 0);
956 old_width = szHint.width; 957 old_width = szHint.width;
957 old_height = szHint.height; 958 old_height = szHint.height;
958 959
990 wmHint.window_group = TermWin.parent[0]; 991 wmHint.window_group = TermWin.parent[0];
991 992
992 XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, 993 XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL,
993 (char **)argv, argc, &szHint, &wmHint, &classHint); 994 (char **)argv, argc, &szHint, &wmHint, &classHint);
994 995
996 /* Enable delete window protocol */
997 XSetWMProtocols (display->display, TermWin.parent[0],
998 &xa[XA_WMDELETEWINDOW], 1);
999
995#if ENABLE_FRILLS 1000#if ENABLE_FRILLS
996 long pid = getpid (); 1001 long pid = getpid ();
997 1002
998 XChangeProperty (display->display, TermWin.parent[0], 1003 XChangeProperty (display->display, TermWin.parent[0],
999 display->atom ("_NET_WM_PID"), XA_CARDINAL, 32, 1004 xa[XA_NET_WM_PID], XA_CARDINAL, 32,
1000 PropModeReplace, (unsigned char *)&pid, 1); 1005 PropModeReplace, (unsigned char *)&pid, 1);
1001#endif 1006#endif
1002 1007
1003 XSelectInput (display->display, TermWin.parent[0], 1008 XSelectInput (display->display, TermWin.parent[0],
1004 KeyPressMask 1009 KeyPressMask
1010 | StructureNotifyMask); 1015 | StructureNotifyMask);
1011 termwin_ev.start (display, TermWin.parent[0]); 1016 termwin_ev.start (display, TermWin.parent[0]);
1012 1017
1013#if ENABLE_FRILLS 1018#if ENABLE_FRILLS
1014 if (mwmhints.flags) 1019 if (mwmhints.flags)
1015 { 1020 XChangeProperty (display->display, TermWin.parent[0], xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32,
1016 prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False);
1017 XChangeProperty (display->display, TermWin.parent[0], prop, prop, 32,
1018 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); 1021 PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS);
1019 }
1020#endif 1022#endif
1021 1023
1022 /* 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 */
1023 TermWin_cursor = XCreateFontCursor (display->display, XC_xterm); 1025 TermWin_cursor = XCreateFontCursor (display->display, XC_xterm);
1024 1026

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines