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.281 by sf-exg, Sun Aug 29 18:12:55 2010 UTC vs.
Revision 1.289 by root, Mon Jan 3 03:05:47 2011 UTC

60#ifdef DISPLAY_IS_IP 60#ifdef DISPLAY_IS_IP
61/* On Solaris link with -lsocket and -lnsl */ 61/* On Solaris link with -lsocket and -lnsl */
62#include <sys/types.h> 62#include <sys/types.h>
63#include <sys/socket.h> 63#include <sys/socket.h>
64 64
65/* these next two are probably only on Sun (not Solaris) */ 65/* these next is probably only on Sun (not Solaris) */
66#ifdef HAVE_SYS_SOCKIO_H 66#ifdef HAVE_SYS_SOCKIO_H
67#include <sys/sockio.h> 67#include <sys/sockio.h>
68#endif
69#ifdef HAVE_SYS_BYTEORDER_H
70#include <sys/byteorder.h>
71#endif 68#endif
72 69
73#include <netinet/in.h> 70#include <netinet/in.h>
74#include <arpa/inet.h> 71#include <arpa/inet.h>
75#include <net/if.h> 72#include <net/if.h>
143 140
144 return rval; 141 return rval;
145} 142}
146#endif 143#endif
147 144
148const char *const def_colorName[] = 145static const char *const def_colorName[] =
149 { 146 {
150 COLOR_FOREGROUND, 147 COLOR_FOREGROUND,
151 COLOR_BACKGROUND, 148 COLOR_BACKGROUND,
152 /* low-intensity colors */ 149 /* low-intensity colors */
153 "rgb:00/00/00", // 0: black (Black) 150 "rgb:00/00/00", // 0: black (Black)
632#ifdef HAVE_AFTERIMAGE 629#ifdef HAVE_AFTERIMAGE
633 set_application_name ((char *)rs[Rs_name]); 630 set_application_name ((char *)rs[Rs_name]);
634 set_output_threshold (OUTPUT_LEVEL_WARNING); 631 set_output_threshold (OUTPUT_LEVEL_WARNING);
635#endif 632#endif
636 633
634#ifdef HAVE_PIXBUF
635 g_type_init ();
636#endif
637
637#if ENABLE_PERL 638#if ENABLE_PERL
638 if (!rs[Rs_perl_ext_1]) 639 if (!rs[Rs_perl_ext_1])
639 rs[Rs_perl_ext_1] = "default"; 640 rs[Rs_perl_ext_1] = "default";
640 641
641 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) 642 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1])
815#ifdef ENABLE_TRANSPARENCY 816#ifdef ENABLE_TRANSPARENCY
816 if (option (Opt_transparent)) 817 if (option (Opt_transparent))
817 { 818 {
818 bgPixmap.set_transparent (); 819 bgPixmap.set_transparent ();
819 820
820#ifdef HAVE_AFTERIMAGE
821 if (rs [Rs_blurradius]) 821 if (rs [Rs_blurradius])
822 bgPixmap.set_blur_radius (rs [Rs_blurradius]); 822 bgPixmap.set_blur_radius (rs [Rs_blurradius]);
823#endif 823
824 if (ISSET_PIXCOLOR (Color_tint)) 824 if (ISSET_PIXCOLOR (Color_tint))
825 bgPixmap.set_tint (pix_colors_focused [Color_tint]); 825 bgPixmap.set_tint (pix_colors_focused [Color_tint]);
826 826
827 if (rs [Rs_shade]) 827 if (rs [Rs_shade])
828 bgPixmap.set_shade (rs [Rs_shade]); 828 bgPixmap.set_shade (rs [Rs_shade]);
887 887
888/*----------------------------------------------------------------------*/ 888/*----------------------------------------------------------------------*/
889void 889void
890rxvt_term::init_env () 890rxvt_term::init_env ()
891{ 891{
892 int i;
893 char *val; 892 char *val;
894 893
895#ifdef DISPLAY_IS_IP 894#ifdef DISPLAY_IS_IP
896 /* Fixup display_name for export over pty to any interested terminal 895 /* Fixup display_name for export over pty to any interested terminal
897 * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number 896 * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number
911 val = XDisplayString (dpy); 910 val = XDisplayString (dpy);
912 911
913 if (rs[Rs_display_name] == NULL) 912 if (rs[Rs_display_name] == NULL)
914 rs[Rs_display_name] = val; /* use broken `:0' value */ 913 rs[Rs_display_name] = val; /* use broken `:0' value */
915 914
916 i = strlen (val);
917 env_display = (char *)rxvt_malloc (i + 9); 915 env_display = (char *)rxvt_malloc (strlen (val) + 9);
918 916
919 sprintf (env_display, "DISPLAY=%s", val); 917 sprintf (env_display, "DISPLAY=%s", val);
920 918
921 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]); 919 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]);
922 920
1332 else 1330 else
1333 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); 1331 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1334 1332
1335 destroy_asimage (&result); 1333 destroy_asimage (&result);
1336#endif 1334#endif
1335
1336#ifdef HAVE_PIXBUF
1337 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (file, NULL);
1338 if (!pixbuf)
1339 {
1340 rxvt_warn ("Loading image icon failed, continuing without.\n");
1341 return;
1342 }
1343
1344 unsigned int w = gdk_pixbuf_get_width (pixbuf);
1345 unsigned int h = gdk_pixbuf_get_height (pixbuf);
1346
1347 if (!IN_RANGE_INC (w, 1, 16383) || !IN_RANGE_INC (h, 1, 16383))
1348 {
1349 rxvt_warn ("Icon image too big, continuing without.\n");
1350 g_object_unref (pixbuf);
1351 return;
1352 }
1353
1354 if (long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)))
1355 {
1356 int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
1357 unsigned char *row = gdk_pixbuf_get_pixels (pixbuf);
1358 int channels = gdk_pixbuf_get_n_channels (pixbuf);
1359
1360 buffer [0] = w;
1361 buffer [1] = h;
1362 for (int i = 0; i < h; i++)
1363 {
1364 for (int j = 0; j < w; j++)
1365 {
1366 unsigned char *pixel = row + j * channels;
1367 long value;
1368
1369 if (channels == 4)
1370 value = pixel[3];
1371 else
1372 value = (unsigned char)0x00ff;
1373
1374 value = (value << 8) + pixel[0];
1375 value = (value << 8) + pixel[1];
1376 value = (value << 8) + pixel[2];
1377 buffer[(i * w + j) + 2] = value;
1378 }
1379
1380 row += rowstride;
1381 }
1382
1383 XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32,
1384 PropModeReplace, (const unsigned char *) buffer, 2 + w * h);
1385 free (buffer);
1386 }
1387 else
1388 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1389
1390 g_object_unref (pixbuf);
1391#endif
1337} 1392}
1338 1393
1339/*----------------------------------------------------------------------*/ 1394/*----------------------------------------------------------------------*/
1340/* rxvt_Create_Windows () - Open and map the window */ 1395/* rxvt_Create_Windows () - Open and map the window */
1341void 1396void
1447#if ENABLE_EWMH 1502#if ENABLE_EWMH
1448 xa[XA_NET_WM_PING], 1503 xa[XA_NET_WM_PING],
1449#endif 1504#endif
1450 }; 1505 };
1451 1506
1452 XSetWMProtocols (dpy, top, protocols, sizeof (protocols) / sizeof (protocols[0])); 1507 XSetWMProtocols (dpy, top, protocols, ARRAY_LENGTH(protocols));
1453 1508
1454#if ENABLE_FRILLS 1509#if ENABLE_FRILLS
1455 if (rs[Rs_transient_for]) 1510 if (rs[Rs_transient_for])
1456 XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); 1511 XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0));
1457#endif 1512#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines