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.132 by root, Fri Jan 6 02:11:15 2006 UTC vs.
Revision 1.140 by root, Thu Jan 12 01:30:53 2006 UTC

9 * - extensive modifications 9 * - extensive modifications
10 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> 10 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
11 * - extensive modifications 11 * - extensive modifications
12 * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com> 12 * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com>
13 * - QNX support 13 * - QNX support
14 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 14 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com>
15 * 15 *
16 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or 18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version. 19 * (at your option) any later version.
339 rs[Rs_name] = rxvt_r_basename (argv[0]); 339 rs[Rs_name] = rxvt_r_basename (argv[0]);
340 340
341 /* 341 /*
342 * Open display, get options/resources and create the window 342 * Open display, get options/resources and create the window
343 */ 343 */
344
344 if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) 345 if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL)
345 rs[Rs_display_name] = ":0"; 346 rs[Rs_display_name] = ":0";
346 347
347 get_options (r_argc, r_argv); 348 get_options (r_argc, r_argv);
348 349
349 if (!(display = displays.get (rs[Rs_display_name]))) 350 if (!(display = displays.get (rs[Rs_display_name])))
350 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); 351 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
351 352
352 extract_resources (); 353 extract_resources ();
354
353 free (r_argv); 355 free (r_argv);
354 356
355 /* 357 /*
356 * set any defaults not already set 358 * set any defaults not already set
357 */ 359 */
391 pointerBlankDelay = 2; 393 pointerBlankDelay = 2;
392#endif 394#endif
393 395
394 /* no point having a scrollbar without having any scrollback! */ 396 /* no point having a scrollbar without having any scrollback! */
395 if (!saveLines) 397 if (!saveLines)
396 CLR_OPTION (Opt_scrollBar); 398 set_option (Opt_scrollBar, 0);
397 399
398#ifdef PRINTPIPE 400#ifdef PRINTPIPE
399 if (!rs[Rs_print_pipe]) 401 if (!rs[Rs_print_pipe])
400 rs[Rs_print_pipe] = PRINTPIPE; 402 rs[Rs_print_pipe] = PRINTPIPE;
401#endif 403#endif
576 * This should support all European type languages. 578 * This should support all European type languages.
577 */ 579 */
578void 580void
579rxvt_term::set_locale (const char *locale) 581rxvt_term::set_locale (const char *locale)
580{ 582{
583 set_environ (envv);
584
581#if HAVE_XSETLOCALE || HAVE_SETLOCALE 585#if HAVE_XSETLOCALE || HAVE_SETLOCALE
582 free (this->locale); 586 free (this->locale);
583 this->locale = setlocale (LC_CTYPE, locale); 587 this->locale = setlocale (LC_CTYPE, locale);
584 588
585 if (!this->locale) 589 if (!this->locale)
586 { 590 {
587 if (*locale) 591 if (*locale)
588 { 592 {
589 rxvt_warn ("unable to set locale \"%s\", using default locale instead.\n", locale); 593 rxvt_warn ("unable to set locale \"%s\", using C locale instead.\n", locale);
590 setlocale (LC_CTYPE, ""); 594 setlocale (LC_CTYPE, "C");
591 } 595 }
592 else 596 else
593 rxvt_warn ("default locale unavailable, check LC_* and LANG variables. Continuing.\n"); 597 rxvt_warn ("default locale unavailable, check LC_* and LANG variables. Continuing.\n");
594 598
595 this->locale = ""; 599 this->locale = "C";
596 } 600 }
597 601
598 602
599 this->locale = rxvt_strdup (this->locale); 603 this->locale = rxvt_strdup (this->locale);
600 SET_LOCALE (this->locale); 604 SET_LOCALE (this->locale);
615} 619}
616 620
617void 621void
618rxvt_term::init_xlocale () 622rxvt_term::init_xlocale ()
619{ 623{
624 set_environ (envv);
625
620#ifdef USE_XIM 626#ifdef USE_XIM
621 if (!locale) 627 if (!locale)
622 rxvt_warn ("setting locale failed, working without locale support.\n"); 628 rxvt_warn ("setting locale failed, working without locale support.\n");
623 else 629 else
624 { 630 {
1032#endif 1038#endif
1033 }; 1039 };
1034 1040
1035 XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); 1041 XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0]));
1036 1042
1043#if ENABLE_FRILLS
1044 if (rs[Rs_transient_for])
1045 XSetTransientForHint (disp, top, (Window)strtol (rs[Rs_transient_for], 0, 0));
1046#endif
1047
1037#if ENABLE_EWMH 1048#if ENABLE_EWMH
1038 long pid = getpid (); 1049 long pid = getpid ();
1039 1050
1040 XChangeProperty (disp, top, 1051 XChangeProperty (disp, top,
1041 xa[XA_NET_WM_PID], XA_CARDINAL, 32, 1052 xa[XA_NET_WM_PID], XA_CARDINAL, 32,
1084 attributes.bit_gravity = NorthWestGravity; 1095 attributes.bit_gravity = NorthWestGravity;
1085 XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); 1096 XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes);
1086 1097
1087 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; 1098 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
1088 1099
1089#ifdef POINTER_BLANK
1090 if (OPTION (Opt_pointerBlank)) 1100 if (OPTION (Opt_pointerBlank)
1101#ifdef ENABLE_PERL
1102 || perl.self
1103#endif
1104 )
1091 vt_emask |= PointerMotionMask; 1105 vt_emask |= PointerMotionMask;
1092 else 1106 else
1093#endif
1094 vt_emask |= Button1MotionMask | Button3MotionMask; 1107 vt_emask |= Button1MotionMask | Button3MotionMask;
1095 1108
1096 XSelectInput (disp, vt, vt_emask); 1109 XSelectInput (disp, vt, vt_emask);
1097 vt_ev.start (display, vt); 1110 vt_ev.start (display, vt);
1098 1111
1573 execvp (argv[0], (char *const *)argv); 1586 execvp (argv[0], (char *const *)argv);
1574 /* no error message: STDERR is closed! */ 1587 /* no error message: STDERR is closed! */
1575 } 1588 }
1576 else 1589 else
1577 { 1590 {
1578 const char *argv0, *shell; 1591 const char *argv0, *shell;
1579 1592
1580 if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') 1593 if ((shell = getenv ("SHELL")) == NULL || *shell == '\0')
1581 shell = "/bin/sh"; 1594 shell = "/bin/sh";
1582 1595
1583 argv0 = (const char *)rxvt_r_basename (shell); 1596 argv0 = (const char *)rxvt_r_basename (shell);
1588 1601
1589 login[0] = '-'; 1602 login[0] = '-';
1590 strcpy (&login[1], argv0); 1603 strcpy (&login[1], argv0);
1591 argv0 = login; 1604 argv0 = login;
1592 } 1605 }
1606
1593 execlp (shell, argv0, NULL); 1607 execlp (shell, argv0, NULL);
1594 /* no error message: STDERR is closed! */ 1608 /* no error message: STDERR is closed! */
1595 } 1609 }
1596 1610
1597#else /* __QNX__ uses qnxspawn () */ 1611#else /* __QNX__ uses qnxspawn () */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines