Windows: cache custom cursor#3293
Merged
daxpedda merged 1 commit intorust-windowing:masterfrom Jan 5, 2024
Merged
Conversation
d891314 to
8f682c4
Compare
49d7b8a to
1d0854e
Compare
madsmtm
reviewed
Dec 23, 2023
src/platform_impl/windows/icon.rs
Outdated
| Ok(cursor) => cursor, | ||
| Err(err) => { | ||
| warn!("Failed to create custom cursor: {err}"); | ||
| WinCursor::Failed |
Member
There was a problem hiding this comment.
Seeing this, I think the API should actually be something like:
impl CustomCursor {
pub fn from_rgba(
rgba: impl Into<Vec<u8>>,
width: u16,
height: u16,
hotspot_x: u16,
hotspot_y: u16,
) -> CustomCursorBuilder;
}
impl CustomCursorBuilder {
pub fn build<T>(self, window_target: &EventLoopWindowTarget<T>) -> Result<CustomCursor, BadImage>;
}But that can be done later.
Member
Author
There was a problem hiding this comment.
Agreed, will do that in a follow-up.
1d0854e to
c89a673
Compare
c89a673 to
9798664
Compare
msiglreith
approved these changes
Jan 5, 2024
9798664 to
5b3c25f
Compare
5b3c25f to
a50581f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We might want to let
CustomCursorBuilder::build()be able to return an error, but that's a discussion for the future.For now, the behavior doesn't actually change, because before this PR we didn't return an error from
Window::set_custom_cursor()as well.