eneoli / flakeshot

A screenshot tool for unix-systems which runs natively on Wayland and X11!
GNU General Public License v2.0
21 stars 0 forks source link

Wrong colors on Wayland [Hyprland] with XRGB Buffers #158

Open eneoli opened 5 months ago

eneoli commented 5 months ago

What happened?

Taking a screnshot on Hyprland v0.40. turns blue colors into red colos and red colors into blue colors.

How can we reproduce the bug?

  1. Run flakeshot on wayland
  2. Take a screenshot

Display Protocol

Wayland

Which Linux Distro do you use?

Arch

How many monitors do you have and how are they orientated? If you can, please include images of your layout.

Tested on 1 laptop screen and two stationary monitors both in landscape

Relevant log output

No response

eneoli commented 5 months ago

ok thats weird: the buffer type is said to be an Xrgb8888. But in fact it seems to be bgr(A|X?)8888?

eneoli commented 5 months ago

That does the trick (in src/backend/wayland/mod.rs)

Format::Xrgb8888 => {
            // switch r and b channel
            data.chunks_mut(4)
                .for_each(|chunk| {
                    (chunk[0], chunk[2]) = (chunk[2], chunk[0]);
                });
}

But why?

eneoli commented 5 months ago

Maybe thats the culprit: https://github.com/hyprwm/Hyprland/blob/main/src/protocols/ToplevelExportWlrFuncs.hpp#L212