… | |
… | |
1383 | ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); |
1383 | ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); |
1384 | if (im) |
1384 | if (im) |
1385 | { |
1385 | { |
1386 | int w = im->width; |
1386 | int w = im->width; |
1387 | int h = im->height; |
1387 | int h = im->height; |
1388 | long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)); |
|
|
1389 | ASImage *result = scale_asimage (asv, im, |
1388 | ASImage *result = scale_asimage (asv, im, |
1390 | w, h, ASA_ARGB32, |
1389 | w, h, ASA_ARGB32, |
1391 | 100, ASIMAGE_QUALITY_DEFAULT); |
1390 | 100, ASIMAGE_QUALITY_DEFAULT); |
1392 | destroy_asimage (&im); |
1391 | destroy_asimage (&im); |
1393 | |
1392 | |
1394 | if (buffer && result) |
1393 | if (result) |
1395 | { |
1394 | { |
|
|
1395 | long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)); |
|
|
1396 | if (buffer) |
|
|
1397 | { |
1396 | ARGB32 *asbuf = result->alt.argb32; |
1398 | ARGB32 *asbuf = result->alt.argb32; |
1397 | buffer [0] = w; |
1399 | buffer [0] = w; |
1398 | buffer [1] = h; |
1400 | buffer [1] = h; |
1399 | |
1401 | |
1400 | for (unsigned int i = 0; i < w * h; ++i) |
1402 | for (unsigned int i = 0; i < w * h; ++i) |
1401 | buffer [i + 2] = asbuf [i]; |
1403 | buffer [i + 2] = asbuf [i]; |
|
|
1404 | |
|
|
1405 | XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
|
|
1406 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
|
|
1407 | free (buffer); |
|
|
1408 | } |
|
|
1409 | else |
|
|
1410 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
1402 | |
1411 | |
1403 | destroy_asimage (&result); |
1412 | destroy_asimage (&result); |
1404 | XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
|
|
1405 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
|
|
1406 | free (buffer); |
|
|
1407 | } |
1413 | } |
1408 | else |
1414 | else |
1409 | { |
|
|
1410 | if (!buffer) |
|
|
1411 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
|
|
1412 | |
|
|
1413 | if (!result) |
|
|
1414 | rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); |
1415 | rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); |
1415 | } |
|
|
1416 | } |
1416 | } |
1417 | else |
1417 | else |
1418 | rxvt_warn ("Loading image icon failed, continuing without.\n"); |
1418 | rxvt_warn ("Loading image icon failed, continuing without.\n"); |
1419 | } |
1419 | } |
1420 | # endif |
1420 | # endif |