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.297 by sf-exg, Mon Aug 15 11:01:54 2011 UTC vs.
Revision 1.305 by sf-exg, Tue Dec 6 11:29:52 2011 UTC

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/*----------------------------------------------------------------------*/
564const char ** 569const char **
565rxvt_term::init_resources (int argc, const char *const *argv) 570rxvt_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#if ENABLE_PERL 625#if ENABLE_PERL
639 { 632 {
640 rxvt_perl.init (this); 633 rxvt_perl.init (this);
641 HOOK_INVOKE ((this, HOOK_INIT, DT_END)); 634 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
642 } 635 }
643#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 ();
644 641
645 /* 642 /*
646 * set any defaults not already set 643 * set any defaults not already set
647 */ 644 */
648 if (cmd_argv && cmd_argv[0]) 645 if (cmd_argv && cmd_argv[0])
757 return cmd_argv; 754 return cmd_argv;
758} 755}
759 756
760/*----------------------------------------------------------------------*/ 757/*----------------------------------------------------------------------*/
761void 758void
762rxvt_term::init (int argc, const char *const *argv, stringvec *envv) 759rxvt_term::init (int argc, const char *const *argv)
763{ 760{
764 this->envv = envv;
765
766 SET_R (this); 761 SET_R (this);
767 set_locale (""); 762 set_locale ("");
768 set_environ (envv); // a few things in X do not call setlocale :( 763 set_environ (envv); // a few things in X do not call setlocale :(
769 764
770 init_vars (); 765 init_vars ();
784 if (chdir (path)) 779 if (chdir (path))
785 rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); 780 rxvt_fatal ("unable to change into specified shell working directory, aborting.\n");
786 } 781 }
787 782
788 if (option (Opt_scrollBar)) 783 if (option (Opt_scrollBar))
789 scrollBar.state = STATE_IDLE; /* set existence for size calculations */ 784 scrollBar.state = SB_STATE_IDLE; /* set existence for size calculations */
790 785
791 pty = ptytty::create (); 786 pty = ptytty::create ();
787
788#ifdef HAVE_AFTERIMAGE
789 set_application_name ((char *)rs[Rs_name]);
790 set_output_threshold (OUTPUT_LEVEL_WARNING);
791#endif
792
793 // must be called before create_windows, because the latter may call set_icon
794#ifdef HAVE_PIXBUF
795 g_type_init ();
796#endif
792 797
793 create_windows (argc, argv); 798 create_windows (argc, argv);
794 799
795 init_xlocale (); 800 init_xlocale ();
796 801
827#endif 832#endif
828 833
829#ifdef BG_IMAGE_FROM_FILE 834#ifdef BG_IMAGE_FROM_FILE
830 if (rs[Rs_backgroundPixmap]) 835 if (rs[Rs_backgroundPixmap])
831 { 836 {
832 const char *p = rs[Rs_backgroundPixmap];
833
834 if ((p = strchr (p, ';')) != 0)
835 {
836 p++;
837 bg_set_geometry (p);
838 }
839 else
840 bg_set_default_geometry ();
841
842 if (bg_set_file (rs[Rs_backgroundPixmap])) 837 if (bg_set_file (rs[Rs_backgroundPixmap]))
843 if (!bg_window_position_sensitive ()) 838 if (!bg_window_position_sensitive ())
844 update_background (); 839 update_background ();
845 } 840 }
846#endif 841#endif
870 XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], 865 XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO],
871 32, PropModeReplace, (unsigned char *)&info, 2); 866 32, PropModeReplace, (unsigned char *)&info, 2);
872 } 867 }
873#endif 868#endif
874 869
870#if HAVE_STARTUP_NOTIFICATION
871 SnDisplay *snDisplay;
872 SnLauncheeContext *snContext;
873
874 snDisplay = sn_display_new (dpy, NULL, NULL);
875 snContext = sn_launchee_context_new_from_environment (snDisplay, DefaultScreen (dpy));
876
877 /* Tell the window manager that this window is part of the startup context */
878 if (snContext)
879 sn_launchee_context_setup_window (snContext, parent);
880#endif
881
875 XMapWindow (dpy, vt); 882 XMapWindow (dpy, vt);
876 XMapWindow (dpy, parent); 883 XMapWindow (dpy, parent);
884
885#if HAVE_STARTUP_NOTIFICATION
886 if (snContext)
887 {
888 /* Mark the startup process as complete */
889 sn_launchee_context_complete (snContext);
890
891 sn_launchee_context_unref (snContext);
892 }
893
894 sn_display_unref (snDisplay);
895#endif
877 896
878 refresh_check (); 897 refresh_check ();
879} 898}
880 899
881/*----------------------------------------------------------------------*/ 900/*----------------------------------------------------------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines