On Wayland, pre-multiply alpha for custom cursor

Fixes: #3360
This commit is contained in:
Kirill Chibisov 2024-01-30 18:03:21 +04:00
parent dd13ccda4c
commit 21df84b7f4
3 changed files with 11 additions and 7 deletions

View file

@ -56,6 +56,7 @@ fn main() -> Result<(), impl std::error::Error> {
let custom_cursors = [
decode_cursor(include_bytes!("data/cross.png"), &event_loop),
decode_cursor(include_bytes!("data/cross2.png"), &event_loop),
decode_cursor(include_bytes!("data/gradient.png"), &event_loop),
];
event_loop.run(move |event, _elwt| match event {
@ -72,7 +73,7 @@ fn main() -> Result<(), impl std::error::Error> {
Key::Character("1") => {
log::debug!("Setting cursor to {:?}", cursor_idx);
window.set_cursor(custom_cursors[cursor_idx].clone());
cursor_idx = (cursor_idx + 1) % 2;
cursor_idx = (cursor_idx + 1) % 3;
}
Key::Character("2") => {
log::debug!("Setting cursor icon to default");

BIN
examples/data/gradient.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B