… | |
… | |
53 | # endif |
53 | # endif |
54 | #endif |
54 | #endif |
55 | |
55 | |
56 | #ifdef HAVE_NL_LANGINFO |
56 | #ifdef HAVE_NL_LANGINFO |
57 | # include <langinfo.h> |
57 | # include <langinfo.h> |
|
|
58 | #endif |
|
|
59 | |
|
|
60 | #ifdef HAVE_STARTUP_NOTIFICATION |
|
|
61 | # define SN_API_NOT_YET_FROZEN |
|
|
62 | # include <libsn/sn-launchee.h> |
58 | #endif |
63 | #endif |
59 | |
64 | |
60 | #ifdef DISPLAY_IS_IP |
65 | #ifdef DISPLAY_IS_IP |
61 | /* On Solaris link with -lsocket and -lnsl */ |
66 | /* On Solaris link with -lsocket and -lnsl */ |
62 | #include <sys/types.h> |
67 | #include <sys/types.h> |
… | |
… | |
563 | /*----------------------------------------------------------------------*/ |
568 | /*----------------------------------------------------------------------*/ |
564 | const char ** |
569 | const char ** |
565 | rxvt_term::init_resources (int argc, const char *const *argv) |
570 | rxvt_term::init_resources (int argc, const char *const *argv) |
566 | { |
571 | { |
567 | int i, r_argc; |
572 | int i, r_argc; |
568 | const char **cmd_argv, **r_argv; |
573 | const char **cmd_argv; |
569 | |
574 | |
570 | /* |
575 | /* |
571 | * Look for -e option. Find => split and make cmd_argv[] of command args |
576 | * Look for -e option. Find => split and make cmd_argv[] of command args |
572 | */ |
577 | */ |
573 | for (r_argc = 0; r_argc < argc; r_argc++) |
578 | for (r_argc = 0; r_argc < argc; r_argc++) |
… | |
… | |
586 | cmd_argv[i] = (const char *)argv[i + r_argc + 1]; |
591 | cmd_argv[i] = (const char *)argv[i + r_argc + 1]; |
587 | |
592 | |
588 | cmd_argv[i] = NULL; |
593 | cmd_argv[i] = NULL; |
589 | } |
594 | } |
590 | |
595 | |
591 | r_argv = (const char **)rxvt_malloc (sizeof (char *) * (r_argc + 1)); |
|
|
592 | |
|
|
593 | for (i = 0; i < r_argc; i++) |
|
|
594 | r_argv[i] = (const char *)argv[i]; |
|
|
595 | |
|
|
596 | r_argv[i] = NULL; |
|
|
597 | |
|
|
598 | rs[Rs_name] = rxvt_basename (argv[0]); |
596 | rs[Rs_name] = rxvt_basename (argv[0]); |
599 | |
597 | |
600 | /* |
598 | /* |
601 | * Open display, get options/resources and create the window |
599 | * Open display, get options/resources and create the window |
602 | */ |
600 | */ |
603 | |
601 | |
604 | if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) |
602 | if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) |
605 | rs[Rs_display_name] = ":0"; |
603 | rs[Rs_display_name] = ":0"; |
606 | |
604 | |
607 | get_options (r_argc, r_argv); |
605 | get_options (r_argc, argv); |
608 | |
606 | |
609 | if (!(display = displays.get (rs[Rs_display_name]))) |
607 | if (!(display = displays.get (rs[Rs_display_name]))) |
610 | { |
|
|
611 | free (r_argv); |
|
|
612 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
608 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
613 | } |
|
|
614 | |
609 | |
615 | // using a local pointer decreases code size a lot |
610 | // using a local pointer decreases code size a lot |
616 | xa = display->xa; |
611 | xa = display->xa; |
617 | |
612 | |
618 | set (display); |
613 | set (display); |
… | |
… | |
621 | #if XFT |
616 | #if XFT |
622 | if (rs[Rs_depth]) |
617 | if (rs[Rs_depth]) |
623 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
618 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
624 | #endif |
619 | #endif |
625 | |
620 | |
626 | free (r_argv); |
|
|
627 | |
|
|
628 | for (int i = NUM_RESOURCES; i--; ) |
621 | for (int i = NUM_RESOURCES; i--; ) |
629 | if (rs [i] == resval_undef) |
622 | if (rs [i] == resval_undef) |
630 | rs [i] = 0; |
623 | rs [i] = 0; |
631 | |
624 | |
632 | #ifdef HAVE_AFTERIMAGE |
|
|
633 | set_application_name ((char *)rs[Rs_name]); |
|
|
634 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
|
|
635 | #endif |
|
|
636 | |
|
|
637 | #ifdef HAVE_PIXBUF |
|
|
638 | g_type_init (); |
|
|
639 | #endif |
|
|
640 | |
|
|
641 | #if ENABLE_PERL |
625 | #if ENABLE_PERL |
642 | if (!rs[Rs_perl_ext_1]) |
626 | if (!rs[Rs_perl_ext_1]) |
643 | rs[Rs_perl_ext_1] = "default"; |
627 | rs[Rs_perl_ext_1] = "default"; |
644 | |
628 | |
645 | if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) |
629 | if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) |
… | |
… | |
648 | { |
632 | { |
649 | rxvt_perl.init (this); |
633 | rxvt_perl.init (this); |
650 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
634 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
651 | } |
635 | } |
652 | #endif |
636 | #endif |
|
|
637 | |
|
|
638 | // must be called after initialising the perl interpreter as it |
|
|
639 | // may invoke the `on_register_command' hook |
|
|
640 | extract_keysym_resources (); |
653 | |
641 | |
654 | /* |
642 | /* |
655 | * set any defaults not already set |
643 | * set any defaults not already set |
656 | */ |
644 | */ |
657 | if (cmd_argv && cmd_argv[0]) |
645 | if (cmd_argv && cmd_argv[0]) |
… | |
… | |
793 | if (chdir (path)) |
781 | if (chdir (path)) |
794 | rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); |
782 | rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); |
795 | } |
783 | } |
796 | |
784 | |
797 | if (option (Opt_scrollBar)) |
785 | if (option (Opt_scrollBar)) |
798 | scrollBar.state = STATE_IDLE; /* set existence for size calculations */ |
786 | scrollBar.state = SB_STATE_IDLE; /* set existence for size calculations */ |
799 | |
787 | |
800 | pty = ptytty::create (); |
788 | pty = ptytty::create (); |
|
|
789 | |
|
|
790 | #ifdef HAVE_AFTERIMAGE |
|
|
791 | set_application_name ((char *)rs[Rs_name]); |
|
|
792 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
|
|
793 | #endif |
|
|
794 | |
|
|
795 | // must be called before create_windows, because the latter may call set_icon |
|
|
796 | #ifdef HAVE_PIXBUF |
|
|
797 | g_type_init (); |
|
|
798 | #endif |
801 | |
799 | |
802 | create_windows (argc, argv); |
800 | create_windows (argc, argv); |
803 | |
801 | |
804 | init_xlocale (); |
802 | init_xlocale (); |
805 | |
803 | |
… | |
… | |
836 | #endif |
834 | #endif |
837 | |
835 | |
838 | #ifdef BG_IMAGE_FROM_FILE |
836 | #ifdef BG_IMAGE_FROM_FILE |
839 | if (rs[Rs_backgroundPixmap]) |
837 | if (rs[Rs_backgroundPixmap]) |
840 | { |
838 | { |
841 | const char *p = rs[Rs_backgroundPixmap]; |
|
|
842 | |
|
|
843 | if ((p = strchr (p, ';')) != 0) |
|
|
844 | { |
|
|
845 | p++; |
|
|
846 | bg_set_geometry (p); |
|
|
847 | } |
|
|
848 | else |
|
|
849 | bg_set_default_geometry (); |
|
|
850 | |
|
|
851 | if (bg_set_file (rs[Rs_backgroundPixmap])) |
839 | if (bg_set_file (rs[Rs_backgroundPixmap])) |
852 | if (!bg_window_position_sensitive ()) |
840 | if (!bg_window_position_sensitive ()) |
853 | update_background (); |
841 | update_background (); |
854 | } |
842 | } |
855 | #endif |
843 | #endif |
… | |
… | |
879 | XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
867 | XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
880 | 32, PropModeReplace, (unsigned char *)&info, 2); |
868 | 32, PropModeReplace, (unsigned char *)&info, 2); |
881 | } |
869 | } |
882 | #endif |
870 | #endif |
883 | |
871 | |
|
|
872 | #if HAVE_STARTUP_NOTIFICATION |
|
|
873 | SnDisplay *snDisplay; |
|
|
874 | SnLauncheeContext *snContext; |
|
|
875 | |
|
|
876 | snDisplay = sn_display_new (dpy, NULL, NULL); |
|
|
877 | snContext = sn_launchee_context_new_from_environment (snDisplay, DefaultScreen (dpy)); |
|
|
878 | |
|
|
879 | /* Tell the window manager that this window is part of the startup context */ |
|
|
880 | if (snContext) |
|
|
881 | sn_launchee_context_setup_window (snContext, parent); |
|
|
882 | #endif |
|
|
883 | |
884 | XMapWindow (dpy, vt); |
884 | XMapWindow (dpy, vt); |
885 | XMapWindow (dpy, parent); |
885 | XMapWindow (dpy, parent); |
|
|
886 | |
|
|
887 | #if HAVE_STARTUP_NOTIFICATION |
|
|
888 | if (snContext) |
|
|
889 | { |
|
|
890 | /* Mark the startup process as complete */ |
|
|
891 | sn_launchee_context_complete (snContext); |
|
|
892 | |
|
|
893 | sn_launchee_context_unref (snContext); |
|
|
894 | } |
|
|
895 | |
|
|
896 | sn_display_unref (snDisplay); |
|
|
897 | #endif |
886 | |
898 | |
887 | refresh_check (); |
899 | refresh_check (); |
888 | } |
900 | } |
889 | |
901 | |
890 | /*----------------------------------------------------------------------*/ |
902 | /*----------------------------------------------------------------------*/ |
… | |
… | |
1504 | #if ENABLE_EWMH |
1516 | #if ENABLE_EWMH |
1505 | xa[XA_NET_WM_PING], |
1517 | xa[XA_NET_WM_PING], |
1506 | #endif |
1518 | #endif |
1507 | }; |
1519 | }; |
1508 | |
1520 | |
1509 | XSetWMProtocols (dpy, top, protocols, ARRAY_LENGTH(protocols)); |
1521 | XSetWMProtocols (dpy, top, protocols, ecb_array_length (protocols)); |
1510 | |
1522 | |
1511 | #if ENABLE_FRILLS |
1523 | #if ENABLE_FRILLS |
1512 | if (rs[Rs_transient_for]) |
1524 | if (rs[Rs_transient_for]) |
1513 | XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
1525 | XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
1514 | #endif |
1526 | #endif |