… | |
… | |
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 | */ |
578 | void |
580 | void |
579 | rxvt_term::set_locale (const char *locale) |
581 | rxvt_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 | |
617 | void |
621 | void |
618 | rxvt_term::init_xlocale () |
622 | rxvt_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 | { |
… | |
… | |
916 | #if ENABLE_FRILLS |
922 | #if ENABLE_FRILLS |
917 | Atom prop = None; |
923 | Atom prop = None; |
918 | MWMHints mwmhints; |
924 | MWMHints mwmhints; |
919 | #endif |
925 | #endif |
920 | XGCValues gcvalue; |
926 | XGCValues gcvalue; |
921 | long vt_emask; |
|
|
922 | XSetWindowAttributes attributes; |
927 | XSetWindowAttributes attributes; |
923 | XWindowAttributes gattr; |
928 | XWindowAttributes gattr; |
924 | Window top, parent; |
929 | Window top, parent; |
925 | dDisp; |
930 | dDisp; |
926 | |
931 | |
… | |
… | |
1032 | #endif |
1037 | #endif |
1033 | }; |
1038 | }; |
1034 | |
1039 | |
1035 | XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); |
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 | #if ENABLE_EWMH |
1047 | #if ENABLE_EWMH |
1038 | long pid = getpid (); |
1048 | long pid = getpid (); |
1039 | |
1049 | |
1040 | XChangeProperty (disp, top, |
1050 | XChangeProperty (disp, top, |
1041 | xa[XA_NET_WM_PID], XA_CARDINAL, 32, |
1051 | xa[XA_NET_WM_PID], XA_CARDINAL, 32, |
… | |
… | |
1084 | attributes.bit_gravity = NorthWestGravity; |
1094 | attributes.bit_gravity = NorthWestGravity; |
1085 | XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); |
1095 | XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); |
1086 | |
1096 | |
1087 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1097 | vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; |
1088 | |
1098 | |
1089 | #ifdef POINTER_BLANK |
|
|
1090 | if (OPTION (Opt_pointerBlank)) |
1099 | if (OPTION (Opt_pointerBlank)) |
1091 | vt_emask |= PointerMotionMask; |
1100 | vt_emask |= PointerMotionMask; |
1092 | else |
1101 | else |
1093 | #endif |
|
|
1094 | vt_emask |= Button1MotionMask | Button3MotionMask; |
1102 | vt_emask |= Button1MotionMask | Button3MotionMask; |
1095 | |
1103 | |
1096 | XSelectInput (disp, vt, vt_emask); |
1104 | vt_select_input (); |
|
|
1105 | |
1097 | vt_ev.start (display, vt); |
1106 | vt_ev.start (display, vt); |
1098 | |
1107 | |
1099 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1108 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1100 | if (menuBar_height ()) |
1109 | if (menuBar_height ()) |
1101 | { |
1110 | { |
… | |
… | |
1573 | execvp (argv[0], (char *const *)argv); |
1582 | execvp (argv[0], (char *const *)argv); |
1574 | /* no error message: STDERR is closed! */ |
1583 | /* no error message: STDERR is closed! */ |
1575 | } |
1584 | } |
1576 | else |
1585 | else |
1577 | { |
1586 | { |
1578 | const char *argv0, *shell; |
1587 | const char *argv0, *shell; |
1579 | |
1588 | |
1580 | if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') |
1589 | if ((shell = getenv ("SHELL")) == NULL || *shell == '\0') |
1581 | shell = "/bin/sh"; |
1590 | shell = "/bin/sh"; |
1582 | |
1591 | |
1583 | argv0 = (const char *)rxvt_r_basename (shell); |
1592 | argv0 = (const char *)rxvt_r_basename (shell); |
… | |
… | |
1588 | |
1597 | |
1589 | login[0] = '-'; |
1598 | login[0] = '-'; |
1590 | strcpy (&login[1], argv0); |
1599 | strcpy (&login[1], argv0); |
1591 | argv0 = login; |
1600 | argv0 = login; |
1592 | } |
1601 | } |
|
|
1602 | |
1593 | execlp (shell, argv0, NULL); |
1603 | execlp (shell, argv0, NULL); |
1594 | /* no error message: STDERR is closed! */ |
1604 | /* no error message: STDERR is closed! */ |
1595 | } |
1605 | } |
1596 | |
1606 | |
1597 | #else /* __QNX__ uses qnxspawn () */ |
1607 | #else /* __QNX__ uses qnxspawn () */ |