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.298 by sf-exg, Fri Aug 19 17:42:09 2011 UTC vs.
Revision 1.304 by sf-exg, Tue Dec 6 10:27:15 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])
784 if (chdir (path)) 781 if (chdir (path))
785 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");
786 } 783 }
787 784
788 if (option (Opt_scrollBar)) 785 if (option (Opt_scrollBar))
789 scrollBar.state = STATE_IDLE; /* set existence for size calculations */ 786 scrollBar.state = SB_STATE_IDLE; /* set existence for size calculations */
790 787
791 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
792 799
793 create_windows (argc, argv); 800 create_windows (argc, argv);
794 801
795 init_xlocale (); 802 init_xlocale ();
796 803
860 XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], 867 XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO],
861 32, PropModeReplace, (unsigned char *)&info, 2); 868 32, PropModeReplace, (unsigned char *)&info, 2);
862 } 869 }
863#endif 870#endif
864 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
865 XMapWindow (dpy, vt); 884 XMapWindow (dpy, vt);
866 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
867 898
868 refresh_check (); 899 refresh_check ();
869} 900}
870 901
871/*----------------------------------------------------------------------*/ 902/*----------------------------------------------------------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines