mirror of
https://github.com/wez/wezterm.git
synced 2024-11-22 04:56:12 +03:00
x11: window icon had red/blue channels swapped
closes: #1754 closes: #1755
This commit is contained in:
parent
5c8ff787c6
commit
623f617951
@ -16,6 +16,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
#### Updated and Improved
|
||||
#### Fixed
|
||||
* Incorrect csi-u encoding with non-ascii characters. [#1746](https://github.com/wez/wezterm/issues/1746)
|
||||
* X11 `_NET_WM_ICON` had red/blue channels swapped [#1754](https://github.com/wez/wezterm/issues/1754)
|
||||
|
||||
### 20220319-142410-0fcdea07
|
||||
|
||||
|
11
test-data/extract-x11-icon.sh
Executable file
11
test-data/extract-x11-icon.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
xprop -notype 32c _NET_WM_ICON |
|
||||
perl -0777 -pe '@_=/\d+/g;
|
||||
printf "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 4\nMAXVAL 255\nTUPLTYPE RGB_ALPHA\nENDHDR\n", splice@_,0,2;
|
||||
$_=pack "N*", @_;
|
||||
s/(.)(...)/$2$1/gs' > /tmp/icon.pam
|
||||
|
||||
convert /tmp/icon.pam /tmp/icon.png
|
||||
wezterm imgcat /tmp/icon.png
|
||||
|
@ -1057,7 +1057,12 @@ impl XWindowInner {
|
||||
let mut icon_data = Vec::with_capacity((2 + (width * height)) * 4);
|
||||
icon_data.push(width as u32);
|
||||
icon_data.push(height as u32);
|
||||
icon_data.extend_from_slice(image.pixels());
|
||||
// `BitmapImage` is rgba32, so we need to munge to get argb32.
|
||||
// We also need to put the data into big endian format.
|
||||
for pixel in image.pixels() {
|
||||
let [r, g, b, a] = pixel.to_ne_bytes();
|
||||
icon_data.push(u32::from_be_bytes([a, r, g, b]));
|
||||
}
|
||||
|
||||
xcb_util::ewmh::set_wm_icon(
|
||||
self.conn().ewmh_conn(),
|
||||
|
Loading…
Reference in New Issue
Block a user