diff options
author | Pierre-Loup A. Griffais <git@plagman.net> | 2020-06-06 15:12:07 -0700 |
---|---|---|
committer | Pierre-Loup A. Griffais <git@plagman.net> | 2020-11-01 13:45:26 -0800 |
commit | e25ae1d9b03a84c3ca825745156af2a7045f04e5 (patch) | |
tree | 1b2d926f9e76e631ac18b557f04569b101c2a8c2 /xprop.c | |
parent | 33042c835583b77c31f38f33e5560e596a416662 (diff) |
Fix aspect ratio for icon display by using two characters per icon pixel.
Diffstat (limited to 'xprop.c')
-rw-r--r-- | xprop.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -766,7 +766,7 @@ Format_Icons (const unsigned long *icon, int len) while (icon < end) { - unsigned long width, height; + unsigned long width, height, display_width; unsigned int icon_pixel_bytes; unsigned int icon_line_bytes; int w, h; @@ -774,13 +774,14 @@ Format_Icons (const unsigned long *icon, int len) width = *icon++; height = *icon++; + display_width = width * 2; /* Two characters per icon pixel. */ icon_pixel_bytes = 1; if (is_utf8_locale()) icon_pixel_bytes = 3; /* Up to 3 bytes per character in that mode. */ /* Initial tab, pixels, and newline. */ - icon_line_bytes = 8 + width * icon_pixel_bytes + 1; + icon_line_bytes = 8 + display_width * icon_pixel_bytes + 1; offset = (tail - result); @@ -797,7 +798,7 @@ Format_Icons (const unsigned long *icon, int len) tail += sprintf (tail, "\tIcon (%lu x %lu):\n", width, height); - if ((width + 8) > term_width || height > 144) + if ((display_width + 8) > term_width || height > 144) { tail += sprintf (tail, "\t(not shown)"); icon += width * height; @@ -838,7 +839,7 @@ Format_Icons (const unsigned long *icon, int len) idx = (brightness * ((sizeof (palette)/sizeof(palette[0])) - 1)) / 1000; - tail += sprintf (tail, "%s", palette[idx]); + tail += sprintf (tail, "%s%s", palette[idx], palette[idx]); } else { @@ -849,6 +850,7 @@ Format_Icons (const unsigned long *icon, int len) idx = (brightness * (sizeof(palette) - 2)) / 1000; *tail++ = palette[idx]; + *tail++ = palette[idx]; } } |