x11: add window icon
The png file added to etc/ are taken from the link mentioned in commit
303096b, except that they have been converted to 16 bit, sRGB (with
color profile info dropped, if there was one), and transparent pixels
reset for better compression.
The file x11_icon.bin is generated by gen-x11-icon.sh. I'm adding it to
the git repo directly, because the script requires ImageMagick, and we
don't want to make building even more complicated.
The way how this is done is basically a compromise between effort
required in x11_common.c and in gen-x11-icon.sh. Ideally, x11_icon.bin
would be directly in the format as required by _NET_WM_ICON, but trying
to write the binary width/height values from shell would probably be a
nightmare, so here we go.
The zlib code in x11_common.c is lifted from demux_mkv.c, with some
modifications (like accepting a gzip header, because I don't know how to
make gzip write raw compressed data).
2013-09-01 21:26:44 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This script is expected to be called as TOOLS/gen-x11-icon.sh (it will access
|
|
|
|
# etc/mpv-icon...), and it will write video/out/x11_icon.bin.
|
|
|
|
|
|
|
|
conv() {
|
|
|
|
echo
|
2014-09-16 00:50:43 +00:00
|
|
|
identify -format "icon: %w %h" "$1"
|
|
|
|
convert "$1" -depth 8 rgba:-
|
x11: add window icon
The png file added to etc/ are taken from the link mentioned in commit
303096b, except that they have been converted to 16 bit, sRGB (with
color profile info dropped, if there was one), and transparent pixels
reset for better compression.
The file x11_icon.bin is generated by gen-x11-icon.sh. I'm adding it to
the git repo directly, because the script requires ImageMagick, and we
don't want to make building even more complicated.
The way how this is done is basically a compromise between effort
required in x11_common.c and in gen-x11-icon.sh. Ideally, x11_icon.bin
would be directly in the format as required by _NET_WM_ICON, but trying
to write the binary width/height values from shell would probably be a
nightmare, so here we go.
The zlib code in x11_common.c is lifted from demux_mkv.c, with some
modifications (like accepting a gzip header, because I don't know how to
make gzip write raw compressed data).
2013-09-01 21:26:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
(echo "# File generated by gen-x11-icon.sh" ;
|
|
|
|
conv etc/mpv-icon-8bit-16x16.png ;
|
|
|
|
conv etc/mpv-icon-8bit-32x32.png ;
|
|
|
|
conv etc/mpv-icon-8bit-64x64.png) | gzip -c > video/out/x11_icon.bin
|