… | |
… | |
1279 | |
1279 | |
1280 | if (i) |
1280 | if (i) |
1281 | ModMetaMask = modmasks[i - 1]; |
1281 | ModMetaMask = modmasks[i - 1]; |
1282 | } |
1282 | } |
1283 | |
1283 | |
|
|
1284 | void |
|
|
1285 | rxvt_term::set_icon (const char *file) |
|
|
1286 | { |
|
|
1287 | #ifdef HAVE_AFTERIMAGE |
|
|
1288 | init_asv (); |
|
|
1289 | |
|
|
1290 | ASImage *im = file2ASImage (file, 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); |
|
|
1291 | if (!im) |
|
|
1292 | { |
|
|
1293 | rxvt_warn ("Loading image icon failed, continuing without.\n"); |
|
|
1294 | return; |
|
|
1295 | } |
|
|
1296 | |
|
|
1297 | int w = im->width; |
|
|
1298 | int h = im->height; |
|
|
1299 | |
|
|
1300 | ASImage *result = scale_asimage (asv, im, |
|
|
1301 | w, h, ASA_ARGB32, |
|
|
1302 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
1303 | destroy_asimage (&im); |
|
|
1304 | |
|
|
1305 | if (!result) |
|
|
1306 | { |
|
|
1307 | rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); |
|
|
1308 | return; |
|
|
1309 | } |
|
|
1310 | |
|
|
1311 | long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)); |
|
|
1312 | if (buffer) |
|
|
1313 | { |
|
|
1314 | ARGB32 *asbuf = result->alt.argb32; |
|
|
1315 | buffer [0] = w; |
|
|
1316 | buffer [1] = h; |
|
|
1317 | |
|
|
1318 | for (unsigned int i = 0; i < w * h; ++i) |
|
|
1319 | buffer [i + 2] = asbuf [i]; |
|
|
1320 | |
|
|
1321 | XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
|
|
1322 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
|
|
1323 | free (buffer); |
|
|
1324 | } |
|
|
1325 | else |
|
|
1326 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
|
|
1327 | |
|
|
1328 | destroy_asimage (&result); |
|
|
1329 | #endif |
|
|
1330 | } |
|
|
1331 | |
1284 | /*----------------------------------------------------------------------*/ |
1332 | /*----------------------------------------------------------------------*/ |
1285 | /* rxvt_Create_Windows () - Open and map the window */ |
1333 | /* rxvt_Create_Windows () - Open and map the window */ |
1286 | void |
1334 | void |
1287 | rxvt_term::create_windows (int argc, const char *const *argv) |
1335 | rxvt_term::create_windows (int argc, const char *const *argv) |
1288 | { |
1336 | { |
… | |
… | |
1368 | wmHint.window_group = top; |
1416 | wmHint.window_group = top; |
1369 | |
1417 | |
1370 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1418 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1371 | &szHint, &wmHint, &classHint); |
1419 | &szHint, &wmHint, &classHint); |
1372 | #if ENABLE_EWMH |
1420 | #if ENABLE_EWMH |
1373 | # ifdef HAVE_AFTERIMAGE |
|
|
1374 | /* |
1421 | /* |
1375 | * set up icon hint |
1422 | * set up icon hint |
1376 | * rs [Rs_iconfile] is path to icon |
1423 | * rs [Rs_iconfile] is path to icon |
1377 | */ |
1424 | */ |
1378 | |
1425 | |
1379 | if (rs [Rs_iconfile]) |
1426 | if (rs [Rs_iconfile]) |
1380 | { |
1427 | { |
1381 | init_asv (); |
1428 | set_icon (rs [Rs_iconfile]); |
1382 | |
|
|
1383 | ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); |
|
|
1384 | if (im) |
|
|
1385 | { |
|
|
1386 | int w = im->width; |
|
|
1387 | int h = im->height; |
|
|
1388 | ASImage *result = scale_asimage (asv, im, |
|
|
1389 | w, h, ASA_ARGB32, |
|
|
1390 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
1391 | destroy_asimage (&im); |
|
|
1392 | |
|
|
1393 | if (result) |
|
|
1394 | { |
|
|
1395 | long *buffer = (long *)malloc ((2 + w * h) * sizeof (long)); |
|
|
1396 | if (buffer) |
|
|
1397 | { |
|
|
1398 | ARGB32 *asbuf = result->alt.argb32; |
|
|
1399 | buffer [0] = w; |
|
|
1400 | buffer [1] = h; |
|
|
1401 | |
|
|
1402 | for (unsigned int i = 0; i < w * h; ++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"); |
|
|
1411 | |
|
|
1412 | destroy_asimage (&result); |
|
|
1413 | } |
|
|
1414 | else |
|
|
1415 | rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); |
|
|
1416 | } |
|
|
1417 | else |
|
|
1418 | rxvt_warn ("Loading image icon failed, continuing without.\n"); |
|
|
1419 | } |
1429 | } |
1420 | # endif |
|
|
1421 | #endif |
1430 | #endif |
1422 | |
1431 | |
1423 | #if ENABLE_FRILLS |
1432 | #if ENABLE_FRILLS |
1424 | if (mwmhints.flags) |
1433 | if (mwmhints.flags) |
1425 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1434 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |