~ubuntu-branches/ubuntu/dapper/rxvt-unicode/dapper

« back to all changes in this revision

Viewing changes to src/init.C

  • Committer: Bazaar Package Importer
  • Author(s): Eduard Bloch
  • Date: 2006-01-16 16:51:28 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20060116165128-dmz1wi3x3e17gu43
Tags: 7.0-1
* New upstream release
  + autodetection of (incorrect) Latin1 in pure UTF-8 environment works
    again (closes: #347718)
* removed the font name preset, automatic selection works acceptably well

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 *                              - extensive modifications
12
12
 * Copyright (c) 1999      D J Hawkey Jr <hawkeyd@visi.com>
13
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
16
 * This program is free software; you can redistribute it and/or modify
17
17
 * it under the terms of the GNU General Public License as published by
341
341
  /*
342
342
   * Open display, get options/resources and create the window
343
343
   */
 
344
 
344
345
  if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL)
345
346
    rs[Rs_display_name] = ":0";
346
347
 
350
351
    rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
351
352
 
352
353
  extract_resources ();
 
354
 
353
355
  free (r_argv);
354
356
 
355
357
  /*
393
395
 
394
396
  /* no point having a scrollbar without having any scrollback! */
395
397
  if (!saveLines)
396
 
    CLR_OPTION (Opt_scrollBar);
 
398
    set_option (Opt_scrollBar, 0);
397
399
 
398
400
#ifdef PRINTPIPE
399
401
  if (!rs[Rs_print_pipe])
578
580
void
579
581
rxvt_term::set_locale (const char *locale)
580
582
{
 
583
  set_environ (envv);
 
584
 
581
585
#if HAVE_XSETLOCALE || HAVE_SETLOCALE
582
586
  free (this->locale);
583
587
  this->locale = setlocale (LC_CTYPE, locale);
586
590
    {
587
591
      if (*locale)
588
592
        {
589
 
          rxvt_warn ("unable to set locale \"%s\", using default locale instead.\n", locale);
590
 
          setlocale (LC_CTYPE, "");
 
593
          rxvt_warn ("unable to set locale \"%s\", using C locale instead.\n", locale);
 
594
          setlocale (LC_CTYPE, "C");
591
595
        }
592
596
      else
593
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
 
617
621
void
618
622
rxvt_term::init_xlocale ()
619
623
{
 
624
  set_environ (envv);
 
625
 
620
626
#ifdef USE_XIM
621
627
  if (!locale)
622
628
    rxvt_warn ("setting locale failed, working without locale support.\n");
918
924
  MWMHints mwmhints;
919
925
#endif
920
926
  XGCValues gcvalue;
921
 
  long vt_emask;
922
927
  XSetWindowAttributes attributes;
923
928
  XWindowAttributes gattr;
924
929
  Window top, parent;
1034
1039
 
1035
1040
  XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0]));
1036
1041
 
 
1042
#if ENABLE_FRILLS
 
1043
  if (rs[Rs_transient_for])
 
1044
    XSetTransientForHint (disp, top, (Window)strtol (rs[Rs_transient_for], 0, 0));
 
1045
#endif
 
1046
 
1037
1047
#if ENABLE_EWMH
1038
1048
  long pid = getpid ();
1039
1049
 
1086
1096
 
1087
1097
  vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
1088
1098
 
1089
 
#ifdef POINTER_BLANK
1090
1099
  if (OPTION (Opt_pointerBlank))
1091
1100
    vt_emask |= PointerMotionMask;
1092
1101
  else
1093
 
#endif
1094
1102
    vt_emask |= Button1MotionMask | Button3MotionMask;
1095
1103
 
1096
 
  XSelectInput (disp, vt, vt_emask);
 
1104
  vt_select_input ();
 
1105
 
1097
1106
  vt_ev.start (display, vt);
1098
1107
 
1099
1108
#if defined(MENUBAR) && (MENUBAR_MAX > 1)
1404
1413
    {
1405
1414
      pty.pty = atoi (rs[Rs_pty_fd]);
1406
1415
 
1407
 
      if (getfd_hook)
1408
 
        pty.pty = (*getfd_hook) (pty.pty);
 
1416
      if (pty.pty >= 0)
 
1417
        {
 
1418
          if (getfd_hook)
 
1419
            pty.pty = (*getfd_hook) (pty.pty);
1409
1420
 
1410
 
      if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK))
1411
 
        rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
 
1421
          if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK))
 
1422
            rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
 
1423
        }
1412
1424
    }
1413
1425
  else
1414
1426
#endif
1572
1584
    }
1573
1585
  else
1574
1586
    {
1575
 
      const char     *argv0, *shell;
 
1587
      const char *argv0, *shell;
1576
1588
 
1577
1589
      if ((shell = getenv ("SHELL")) == NULL || *shell == '\0')
1578
1590
        shell = "/bin/sh";
1587
1599
          strcpy (&login[1], argv0);
1588
1600
          argv0 = login;
1589
1601
        }
 
1602
 
1590
1603
      execlp (shell, argv0, NULL);
1591
1604
      /* no error message: STDERR is closed! */
1592
1605
    }