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.278 by sf-exg, Sun Aug 29 15:04:40 2010 UTC vs.
Revision 1.290 by sf-exg, Mon Jan 3 10:32:08 2011 UTC

143 143
144 return rval; 144 return rval;
145} 145}
146#endif 146#endif
147 147
148const char *const def_colorName[] = 148static const char *const def_colorName[] =
149 { 149 {
150 COLOR_FOREGROUND, 150 COLOR_FOREGROUND,
151 COLOR_BACKGROUND, 151 COLOR_BACKGROUND,
152 /* low-intensity colors */ 152 /* low-intensity colors */
153 "rgb:00/00/00", // 0: black (Black) 153 "rgb:00/00/00", // 0: black (Black)
632#ifdef HAVE_AFTERIMAGE 632#ifdef HAVE_AFTERIMAGE
633 set_application_name ((char *)rs[Rs_name]); 633 set_application_name ((char *)rs[Rs_name]);
634 set_output_threshold (OUTPUT_LEVEL_WARNING); 634 set_output_threshold (OUTPUT_LEVEL_WARNING);
635#endif 635#endif
636 636
637#ifdef HAVE_PIXBUF
638 g_type_init ();
639#endif
640
637#if ENABLE_PERL 641#if ENABLE_PERL
638 if (!rs[Rs_perl_ext_1]) 642 if (!rs[Rs_perl_ext_1])
639 rs[Rs_perl_ext_1] = "default"; 643 rs[Rs_perl_ext_1] = "default";
640 644
641 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) 645 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1])
815#ifdef ENABLE_TRANSPARENCY 819#ifdef ENABLE_TRANSPARENCY
816 if (option (Opt_transparent)) 820 if (option (Opt_transparent))
817 { 821 {
818 bgPixmap.set_transparent (); 822 bgPixmap.set_transparent ();
819 823
820#ifdef HAVE_AFTERIMAGE
821 if (rs [Rs_blurradius]) 824 if (rs [Rs_blurradius])
822 bgPixmap.set_blur_radius (rs [Rs_blurradius]); 825 bgPixmap.set_blur_radius (rs [Rs_blurradius]);
823#endif 826
824 if (ISSET_PIXCOLOR (Color_tint)) 827 if (ISSET_PIXCOLOR (Color_tint))
825 bgPixmap.set_tint (pix_colors_focused [Color_tint]); 828 bgPixmap.set_tint (pix_colors_focused [Color_tint]);
826 829
827 if (rs [Rs_shade]) 830 if (rs [Rs_shade])
828 bgPixmap.set_shade (rs [Rs_shade]); 831 bgPixmap.set_shade (rs [Rs_shade]);
887 890
888/*----------------------------------------------------------------------*/ 891/*----------------------------------------------------------------------*/
889void 892void
890rxvt_term::init_env () 893rxvt_term::init_env ()
891{ 894{
892 int i;
893 char *val; 895 char *val;
894 896
895#ifdef DISPLAY_IS_IP 897#ifdef DISPLAY_IS_IP
896 /* Fixup display_name for export over pty to any interested terminal 898 /* 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 899 * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number
911 val = XDisplayString (dpy); 913 val = XDisplayString (dpy);
912 914
913 if (rs[Rs_display_name] == NULL) 915 if (rs[Rs_display_name] == NULL)
914 rs[Rs_display_name] = val; /* use broken `:0' value */ 916 rs[Rs_display_name] = val; /* use broken `:0' value */
915 917
916 i = strlen (val);
917 env_display = (char *)rxvt_malloc (i + 9); 918 env_display = (char *)rxvt_malloc (strlen (val) + 9);
918 919
919 sprintf (env_display, "DISPLAY=%s", val); 920 sprintf (env_display, "DISPLAY=%s", val);
920 921
921 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]); 922 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]);
922 923
1292 { 1293 {
1293 rxvt_warn ("Loading image icon failed, continuing without.\n"); 1294 rxvt_warn ("Loading image icon failed, continuing without.\n");
1294 return; 1295 return;
1295 } 1296 }
1296 1297
1297 int w = im->width; 1298 unsigned int w = im->width;
1298 int h = im->height; 1299 unsigned int h = im->height;
1300
1301 if (!IN_RANGE_INC (w, 1, 16383) || !IN_RANGE_INC (h, 1, 16383))
1302 {
1303 rxvt_warn ("Icon image too big, continuing without.\n");
1304 destroy_asimage (&im);
1305 return;
1306 }
1299 1307
1300 ASImage *result = scale_asimage (asv, im, 1308 ASImage *result = scale_asimage (asv, im,
1301 w, h, ASA_ARGB32, 1309 w, h, ASA_ARGB32,
1302 100, ASIMAGE_QUALITY_DEFAULT); 1310 100, ASIMAGE_QUALITY_DEFAULT);
1303 destroy_asimage (&im); 1311 destroy_asimage (&im);
1324 } 1332 }
1325 else 1333 else
1326 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); 1334 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1327 1335
1328 destroy_asimage (&result); 1336 destroy_asimage (&result);
1337#endif
1338
1339#ifdef HAVE_PIXBUF
1340 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (file, NULL);
1341 if (!pixbuf)
1342 {
1343 rxvt_warn ("Loading image icon failed, continuing without.\n");
1344 return;
1345 }
1346
1347 unsigned int w = gdk_pixbuf_get_width (pixbuf);
1348 unsigned int h = gdk_pixbuf_get_height (pixbuf);
1349
1350 if (!IN_RANGE_INC (w, 1, 16383) || !IN_RANGE_INC (h, 1, 16383))
1351 {
1352 rxvt_warn ("Icon image too big, continuing without.\n");
1353 g_object_unref (pixbuf);
1354 return;
1355 }
1356
1357 if (long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)))
1358 {
1359 int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
1360 unsigned char *row = gdk_pixbuf_get_pixels (pixbuf);
1361 int channels = gdk_pixbuf_get_n_channels (pixbuf);
1362
1363 buffer [0] = w;
1364 buffer [1] = h;
1365 for (int i = 0; i < h; i++)
1366 {
1367 for (int j = 0; j < w; j++)
1368 {
1369 unsigned char *pixel = row + j * channels;
1370 long value;
1371
1372 if (channels == 4)
1373 value = pixel[3];
1374 else
1375 value = (unsigned char)0x00ff;
1376
1377 value = (value << 8) + pixel[0];
1378 value = (value << 8) + pixel[1];
1379 value = (value << 8) + pixel[2];
1380 buffer[(i * w + j) + 2] = value;
1381 }
1382
1383 row += rowstride;
1384 }
1385
1386 XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32,
1387 PropModeReplace, (const unsigned char *) buffer, 2 + w * h);
1388 free (buffer);
1389 }
1390 else
1391 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1392
1393 g_object_unref (pixbuf);
1329#endif 1394#endif
1330} 1395}
1331 1396
1332/*----------------------------------------------------------------------*/ 1397/*----------------------------------------------------------------------*/
1333/* rxvt_Create_Windows () - Open and map the window */ 1398/* rxvt_Create_Windows () - Open and map the window */
1440#if ENABLE_EWMH 1505#if ENABLE_EWMH
1441 xa[XA_NET_WM_PING], 1506 xa[XA_NET_WM_PING],
1442#endif 1507#endif
1443 }; 1508 };
1444 1509
1445 XSetWMProtocols (dpy, top, protocols, sizeof (protocols) / sizeof (protocols[0])); 1510 XSetWMProtocols (dpy, top, protocols, ARRAY_LENGTH(protocols));
1446 1511
1447#if ENABLE_FRILLS 1512#if ENABLE_FRILLS
1448 if (rs[Rs_transient_for]) 1513 if (rs[Rs_transient_for])
1449 XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); 1514 XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0));
1450#endif 1515#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines