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.280 by sf-exg, Sun Aug 29 17:58:54 2010 UTC vs.
Revision 1.284 by sf-exg, Fri Oct 15 21:59:25 2010 UTC

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 gdk_pixbuf_xlib_init_with_depth (dpy, display->screen, depth);
640#endif
641
637#if ENABLE_PERL 642#if ENABLE_PERL
638 if (!rs[Rs_perl_ext_1]) 643 if (!rs[Rs_perl_ext_1])
639 rs[Rs_perl_ext_1] = "default"; 644 rs[Rs_perl_ext_1] = "default";
640 645
641 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) 646 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1])
815#ifdef ENABLE_TRANSPARENCY 820#ifdef ENABLE_TRANSPARENCY
816 if (option (Opt_transparent)) 821 if (option (Opt_transparent))
817 { 822 {
818 bgPixmap.set_transparent (); 823 bgPixmap.set_transparent ();
819 824
820#ifdef HAVE_AFTERIMAGE
821 if (rs [Rs_blurradius]) 825 if (rs [Rs_blurradius])
822 bgPixmap.set_blur_radius (rs [Rs_blurradius]); 826 bgPixmap.set_blur_radius (rs [Rs_blurradius]);
823#endif 827
824 if (ISSET_PIXCOLOR (Color_tint)) 828 if (ISSET_PIXCOLOR (Color_tint))
825 bgPixmap.set_tint (pix_colors_focused [Color_tint]); 829 bgPixmap.set_tint (pix_colors_focused [Color_tint]);
826 830
827 if (rs [Rs_shade]) 831 if (rs [Rs_shade])
828 bgPixmap.set_shade (rs [Rs_shade]); 832 bgPixmap.set_shade (rs [Rs_shade]);
1292 { 1296 {
1293 rxvt_warn ("Loading image icon failed, continuing without.\n"); 1297 rxvt_warn ("Loading image icon failed, continuing without.\n");
1294 return; 1298 return;
1295 } 1299 }
1296 1300
1297 int w = im->width; 1301 unsigned int w = im->width;
1298 int h = im->height; 1302 unsigned int h = im->height;
1299 1303
1300 if (!IN_RANGE_INC (w, 1, 16383) || !IN_RANGE_INC (h, 1, 16383)) 1304 if (!IN_RANGE_INC (w, 1, 16383) || !IN_RANGE_INC (h, 1, 16383))
1301 { 1305 {
1302 rxvt_warn ("Icon image too big, continuing without.\n"); 1306 rxvt_warn ("Icon image too big, continuing without.\n");
1303 destroy_asimage (&im); 1307 destroy_asimage (&im);
1331 } 1335 }
1332 else 1336 else
1333 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); 1337 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1334 1338
1335 destroy_asimage (&result); 1339 destroy_asimage (&result);
1340#endif
1341
1342#ifdef HAVE_PIXBUF
1343 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (file, NULL);
1344 if (!pixbuf)
1345 {
1346 rxvt_warn ("Loading image icon failed, continuing without.\n");
1347 return;
1348 }
1349
1350 unsigned int w = gdk_pixbuf_get_width (pixbuf);
1351 unsigned int h = gdk_pixbuf_get_height (pixbuf);
1352
1353 if (!IN_RANGE_INC (w, 1, 16383) || !IN_RANGE_INC (h, 1, 16383))
1354 {
1355 rxvt_warn ("Icon image too big, continuing without.\n");
1356 g_object_unref (pixbuf);
1357 return;
1358 }
1359
1360 if (long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)))
1361 {
1362 int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
1363 unsigned char *row = gdk_pixbuf_get_pixels (pixbuf);
1364 int channels = gdk_pixbuf_get_n_channels (pixbuf);
1365
1366 buffer [0] = w;
1367 buffer [1] = h;
1368 for (int i = 0; i < h; i++)
1369 {
1370 for (int j = 0; j < w; j++)
1371 {
1372 unsigned char *pixel = row + j * channels;
1373 long value;
1374
1375 if (channels == 4)
1376 value = pixel[3];
1377 else
1378 value = (unsigned char)0x00ff;
1379
1380 value = (value << 8) + pixel[0];
1381 value = (value << 8) + pixel[1];
1382 value = (value << 8) + pixel[2];
1383 buffer[(i * w + j) + 2] = value;
1384 }
1385
1386 row += rowstride;
1387 }
1388
1389 XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32,
1390 PropModeReplace, (const unsigned char *) buffer, 2 + w * h);
1391 free (buffer);
1392 }
1393 else
1394 rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
1395
1396 g_object_unref (pixbuf);
1336#endif 1397#endif
1337} 1398}
1338 1399
1339/*----------------------------------------------------------------------*/ 1400/*----------------------------------------------------------------------*/
1340/* rxvt_Create_Windows () - Open and map the window */ 1401/* rxvt_Create_Windows () - Open and map the window */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines