Open judu opened 4 years ago
Thanks for the report!
@nifker any idea about this one?
It seems this code
fn update_cursor(&mut self, cursor: &str) -> std::result::Result<(), ()> {
let cursor = self.cursor.get_cursor(cursor);
if let Some(cursor) = cursor {
let img = &cursor[0];
self.cursor_surface.attach(Some(&*img), 0, 0);
self.cursor_surface.damage(0, 0, 32, 32);
self.cursor_surface.commit();
return Ok(());
}
Err(())
}
Will return Err(())
and then we will just unwrap()
later on
So it looks like the cursor is not provided by the given system: https://smithay.github.io/wayland-rs/wayland_cursor/struct.CursorTheme.html Maybe some cursor theme is being used which doesnt contain all cursors minifb uses.
That's fun! I did not know that each wayland client was responsible for displaying the cursor! (Or is it not? That's how I understand it. 🤔) Btw, I'm running the default Gnome theme: Adwaita.
Yes but only if you want to display the non-default cursor. Otherwise the libwayland-cursor is not even required. You might want to run it with the flag WAYLAND_DEBUG=1 and post a log(not sure if it gives us more information).
The log is here: https://dpaste.com/AP4ZM585G
I'm not sure it will be useful indeed.
Well the weird thing is that noise
example doesn't change the cursor so I wonder why this code get trigged then?
Because I wrote the code lazily, so that it even loads the default cursor from the CursorTheme.
Right, so the what would be the best way to solve this? I would like to start getting rid of most (all if possible) unwrap
s that exists in the code (that is for all backends) and trickle back the up to the user. In this case they wouldn't be able to solve it tho as this is an internal thing within minifb
As update() returns "()", our option would be to just ok() it.
I think it would be better to return Ok(())
for now, but propagate the errors with a unified Error
type for minifb later on. I think handing this one gracefully is better than panic
I meant that we cant return Ok there because the function only returns an empty tuple.
Hi, I'm doing a stream about Rust, and got affected by this. minifb is by far mi favorite rust lib, so I'm not complaining, actually, keep it up. I really like being able to have per-pixel access, and also be able to run it on old hardware without drivers, or ancient opengl versions. Going back on topic, I created this PR: https://github.com/emoon/rust_minifb/pull/238
comments, corrections, fixes are all welcome. Feel free to also downvote whatever you don't like. Thanks!
This is working OK. I'm using it on wayland without issues. There is no cursor, obviously, but it no longer closes itself.
Libs
The problem
Tried to run the noise example. It runs, it displays noise. But when I move my mouse cursor over the window, the app crashes with the following stack: