Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom cursor images for all desktop platforms #3218
Custom cursor images for all desktop platforms #3218
Changes from 34 commits
6f7f7c3
9da54a8
c3267b9
28b7a61
c031a2d
a0579b7
c86503a
a813832
c96738b
f68d731
fda16f4
7304d5d
bb5db5b
6412a01
2c43519
5c04cd3
d2e9f41
7357049
de364fe
d03b041
2245b5e
3b56af4
51fce13
fd1bff3
b6be372
134e94d
a4ff890
d2565b9
43e39ff
3bea0ab
0678780
d374d60
64c4826
d337015
951a012
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consideration (that you may have already talked about, if so, I would like to see the reasoning be stated in a code comment):
softbuffer
usesu32
instead ofu8
in its buffer, exactly so that errors like this are entirely avoided.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't have reasoning other than that I copied it from
src/icon.rs
link.I'm fine with using u32, but what about endianess? Currently it is using big endian RGBA pixels, which work directly only in web and macos. Windows, X11 and Wayland want little endian ARGB pixels and need extra processing currently.
But in general I like u8s more because they represent the pixel values more directly. I would expect most users would need to use bitshifts or something to convert their real color values into u32s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eero-lehtinen endianess is explicitly stated in the underlying pixel formats. On Wayland it's always little endian, regardless of used arch, maybe the same on X11.
I'd suggest to follow softbuffer approach to buffers here, since it's known to work and using u32 avoids a lot of errors.
The users need to decode images anyway, and they need to ensure that they have alpha properly in them, like they can't just pass data as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not particularly convinced that
softbuffer
has done the right thing here. Even though endianess seems to be defined for Wayland it isn't clear in other backends/OS's (AFAIK). I wrote up some of my thoughts here: rust-windowing/softbuffer#109.I'm strongly in favor of leaving it as is, as the same API is already used in
Icon
. We can change the API in a follow-up issue/PR where we can have that discussion and change both and not leave them differently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have endianess when you have
u32
at all, if you convert u8 to u32 you have it, but not with just u32 when the platform expects u32 as well. Wayland defines it because it usesu8
, some platforms usebgra
, you have the same bgra on both little and big endian platforms.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good to know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to leave it as is. I already made it and it already works :D.
The change would be annoying, because x11 is the only one that accepts u32, so all others would need to be manually converted to u8. It would remove this single user facing error but not much else, I think. But I'll leave this up to you to choose.