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.293 by root, Mon Feb 21 07:41:01 2011 UTC vs.
Revision 1.303 by sf-exg, Sat Dec 3 11:47:31 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>
605 rs[Rs_display_name] = ":0"; 610 rs[Rs_display_name] = ":0";
606 611
607 get_options (r_argc, r_argv); 612 get_options (r_argc, r_argv);
608 613
609 if (!(display = displays.get (rs[Rs_display_name]))) 614 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]); 615 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
613 }
614 616
615 // using a local pointer decreases code size a lot 617 // using a local pointer decreases code size a lot
616 xa = display->xa; 618 xa = display->xa;
617 619
618 set (display); 620 set (display);
627 629
628 for (int i = NUM_RESOURCES; i--; ) 630 for (int i = NUM_RESOURCES; i--; )
629 if (rs [i] == resval_undef) 631 if (rs [i] == resval_undef)
630 rs [i] = 0; 632 rs [i] = 0;
631 633
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 634#if ENABLE_PERL
642 if (!rs[Rs_perl_ext_1]) 635 if (!rs[Rs_perl_ext_1])
643 rs[Rs_perl_ext_1] = "default"; 636 rs[Rs_perl_ext_1] = "default";
644 637
645 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) 638 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1])
648 { 641 {
649 rxvt_perl.init (this); 642 rxvt_perl.init (this);
650 HOOK_INVOKE ((this, HOOK_INIT, DT_END)); 643 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
651 } 644 }
652#endif 645#endif
646
647 // must be called after initialising the perl interpreter as it
648 // may invoke the `on_register_command' hook
649 extract_keysym_resources ();
653 650
654 /* 651 /*
655 * set any defaults not already set 652 * set any defaults not already set
656 */ 653 */
657 if (cmd_argv && cmd_argv[0]) 654 if (cmd_argv && cmd_argv[0])
793 if (chdir (path)) 790 if (chdir (path))
794 rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); 791 rxvt_fatal ("unable to change into specified shell working directory, aborting.\n");
795 } 792 }
796 793
797 if (option (Opt_scrollBar)) 794 if (option (Opt_scrollBar))
798 scrollBar.state = STATE_IDLE; /* set existence for size calculations */ 795 scrollBar.state = SB_STATE_IDLE; /* set existence for size calculations */
799 796
800 pty = ptytty::create (); 797 pty = ptytty::create ();
798
799#ifdef HAVE_AFTERIMAGE
800 set_application_name ((char *)rs[Rs_name]);
801 set_output_threshold (OUTPUT_LEVEL_WARNING);
802#endif
803
804 // must be called before create_windows, because the latter may call set_icon
805#ifdef HAVE_PIXBUF
806 g_type_init ();
807#endif
801 808
802 create_windows (argc, argv); 809 create_windows (argc, argv);
803 810
804 init_xlocale (); 811 init_xlocale ();
805 812
836#endif 843#endif
837 844
838#ifdef BG_IMAGE_FROM_FILE 845#ifdef BG_IMAGE_FROM_FILE
839 if (rs[Rs_backgroundPixmap]) 846 if (rs[Rs_backgroundPixmap])
840 { 847 {
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])) 848 if (bg_set_file (rs[Rs_backgroundPixmap]))
852 if (!bg_window_position_sensitive ()) 849 if (!bg_window_position_sensitive ())
853 update_background (); 850 update_background ();
854 } 851 }
855#endif 852#endif
874#if ENABLE_XEMBED 871#if ENABLE_XEMBED
875 if (rs[Rs_embed]) 872 if (rs[Rs_embed])
876 { 873 {
877 long info[2] = { 0, XEMBED_MAPPED }; 874 long info[2] = { 0, XEMBED_MAPPED };
878 875
879 XChangeProperty (dpy, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], 876 XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO],
880 32, PropModeReplace, (unsigned char *)&info, 2); 877 32, PropModeReplace, (unsigned char *)&info, 2);
881 } 878 }
882#endif 879#endif
883 880
881#if HAVE_STARTUP_NOTIFICATION
882 SnDisplay *snDisplay;
883 SnLauncheeContext *snContext;
884
885 snDisplay = sn_display_new (dpy, NULL, NULL);
886 snContext = sn_launchee_context_new_from_environment (snDisplay, DefaultScreen (dpy));
887
888 /* Tell the window manager that this window is part of the startup context */
889 if (snContext)
890 sn_launchee_context_setup_window (snContext, parent);
891#endif
892
884 XMapWindow (dpy, vt); 893 XMapWindow (dpy, vt);
885 XMapWindow (dpy, parent[0]); 894 XMapWindow (dpy, parent);
895
896#if HAVE_STARTUP_NOTIFICATION
897 if (snContext)
898 {
899 /* Mark the startup process as complete */
900 sn_launchee_context_complete (snContext);
901
902 sn_launchee_context_unref (snContext);
903 }
904
905 sn_display_unref (snDisplay);
906#endif
886 907
887 refresh_check (); 908 refresh_check ();
888} 909}
889 910
890/*----------------------------------------------------------------------*/ 911/*----------------------------------------------------------------------*/
916 937
917 env_display = (char *)rxvt_malloc (strlen (val) + 9); 938 env_display = (char *)rxvt_malloc (strlen (val) + 9);
918 939
919 sprintf (env_display, "DISPLAY=%s", val); 940 sprintf (env_display, "DISPLAY=%s", val);
920 941
921 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]); 942 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent);
922 943
923 /* add entries to the environment: 944 /* add entries to the environment:
924 * @ DISPLAY: in case we started with -display 945 * @ DISPLAY: in case we started with -display
925 * @ WINDOWID: X window id number of the window 946 * @ WINDOWID: X window id number of the window
926 * @ COLORTERM: terminal sub-name and also indicates its color 947 * @ COLORTERM: terminal sub-name and also indicates its color
1323 buffer [1] = h; 1344 buffer [1] = h;
1324 1345
1325 for (unsigned int i = 0; i < w * h; ++i) 1346 for (unsigned int i = 0; i < w * h; ++i)
1326 buffer [i + 2] = asbuf [i]; 1347 buffer [i + 2] = asbuf [i];
1327 1348
1328 XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32, 1349 XChangeProperty (dpy, parent, xa[XA_NET_WM_ICON], XA_CARDINAL, 32,
1329 PropModeReplace, (const unsigned char *) buffer, 2 + w * h); 1350 PropModeReplace, (const unsigned char *) buffer, 2 + w * h);
1330 free (buffer); 1351 free (buffer);
1331 } 1352 }
1332 else 1353 else
1333 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); 1354 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1380 } 1401 }
1381 1402
1382 row += rowstride; 1403 row += rowstride;
1383 } 1404 }
1384 1405
1385 XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32, 1406 XChangeProperty (dpy, parent, xa[XA_NET_WM_ICON], XA_CARDINAL, 32,
1386 PropModeReplace, (const unsigned char *) buffer, 2 + w * h); 1407 PropModeReplace, (const unsigned char *) buffer, 2 + w * h);
1387 free (buffer); 1408 free (buffer);
1388 } 1409 }
1389 else 1410 else
1390 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); 1411 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1392 g_object_unref (pixbuf); 1413 g_object_unref (pixbuf);
1393#endif 1414#endif
1394} 1415}
1395 1416
1396/*----------------------------------------------------------------------*/ 1417/*----------------------------------------------------------------------*/
1397/* rxvt_Create_Windows () - Open and map the window */ 1418/* Open and map the window */
1398void 1419void
1399rxvt_term::create_windows (int argc, const char *const *argv) 1420rxvt_term::create_windows (int argc, const char *const *argv)
1400{ 1421{
1401 XClassHint classHint; 1422 XClassHint classHint;
1402 XWMHints wmHint; 1423 XWMHints wmHint;
1448 } 1469 }
1449#endif 1470#endif
1450 1471
1451 window_calc (0, 0); 1472 window_calc (0, 0);
1452 1473
1453 /* sub-window placement & size in rxvt_resize_subwindows () */ 1474 /* sub-window placement & size in rxvt_term::resize_all_windows () */
1454 attributes.background_pixel = pix_colors_focused [Color_border]; 1475 attributes.background_pixel = pix_colors_focused [Color_border];
1455 attributes.border_pixel = pix_colors_focused [Color_border]; 1476 attributes.border_pixel = pix_colors_focused [Color_border];
1456 attributes.colormap = cmap; 1477 attributes.colormap = cmap;
1457 1478
1458 top = XCreateWindow (dpy, parent, 1479 top = XCreateWindow (dpy, parent,
1461 ext_bwidth, 1482 ext_bwidth,
1462 depth, InputOutput, visual, 1483 depth, InputOutput, visual,
1463 CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, 1484 CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect,
1464 &attributes); 1485 &attributes);
1465 1486
1466 this->parent[0] = top; 1487 this->parent = top;
1467 1488
1468 old_width = szHint.width; 1489 old_width = szHint.width;
1469 old_height = szHint.height; 1490 old_height = szHint.height;
1470 1491
1471 set_title (rs [Rs_title]); 1492 set_title (rs [Rs_title]);
1504#if ENABLE_EWMH 1525#if ENABLE_EWMH
1505 xa[XA_NET_WM_PING], 1526 xa[XA_NET_WM_PING],
1506#endif 1527#endif
1507 }; 1528 };
1508 1529
1509 XSetWMProtocols (dpy, top, protocols, ARRAY_LENGTH(protocols)); 1530 XSetWMProtocols (dpy, top, protocols, ecb_array_length (protocols));
1510 1531
1511#if ENABLE_FRILLS 1532#if ENABLE_FRILLS
1512 if (rs[Rs_transient_for]) 1533 if (rs[Rs_transient_for])
1513 XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); 1534 XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0));
1514#endif 1535#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines