-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Feature/issue 1031 window icon #2268
Feature/issue 1031 window icon #2268
Conversation
I really appreciate this feature request, and other than some of my initial comments, this looks good so far :) |
Thanks for the quick review and the nice comments. Makes you really feel welcomed :). About the whole Handle thing: Ideally we would find a way to do both with Handle, but a simple (data,width,height) struct might be the most generic solution, that would also allow someone to include_bytes the icon. |
I agree with your assessment on use cases; I would in fact be mildly alarmed if my icon changed at runtime! I personally think that synchronous, blocking image loading may be the correct choice here because it maps onto the use cases better and avoids the circular dependencies. |
This is true, however just because most people may not want this functionality, does that me we should remove the possibility?
I'm not the biggest fan of this approach as it's very easy to mess up just using
Yes this is the tricky part. I'm also in agreement with cart that we should use Some possible paths forward:
|
Hmm yeah theres a bit more nuance here than I initially thought. Heres my current take:
I do think supporting Ultimately (3) could be simplified once we add "async/await on AssetServer in systems", but that will take some time :) |
I really like where this implementation is going, it's starting to look quite a bit better 😄 In response to my comments I left above, here are some viable solutions: An icon can either be a:
When it's set as a When it's the bytes directly, you can just add it directly to the queue. So I would personally have the Let me know if this makes sense or feel free to ask more questions! |
Yes, makes sense.
What if someone does:
With the same path.
Since bevy_winit can not do anything with SetIcon if it has a path I agree.
|
I implemented an alternative version just using window.icon(). The upside: We do not need to expose command queue anymore and it should not matter when the icon_changed system in bevy_render runs anymore. |
@@ -236,3 +242,48 @@ fn check_for_render_resource_context(context: Option<Res<Box<dyn RenderResourceC | |||
); | |||
} | |||
} | |||
|
|||
fn window_icon_changed( |
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.
Something to consider with this system, is that it gets executed each frame.
I'm curious if we can find some fun way to only have it execute when a window's icon is updated, or when the asset server has loaded it's value.
Probably not, but it's something to think about 😅
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.
Hmm, yes.
We could do a roundabout way via a command to bevy_winit and an event from there, but I dont think we should involve bevy_winit for that.
abc9fcc
to
85e870d
Compare
Sorry for the long absence. @NathanSWard btw. Not sure who you are on discord. I assume "Bakuta", but I could not find a link between that account and you github account :D |
Yep, that's me :) feel free to ping me there whenever! |
c7e2a8a
to
cba2b2e
Compare
I think this is done now. Happy to do any necessary changes though. |
Hmm, this mostly looks good but I'm not sure whether we should couple this to bevy_render - it feels like this'd be more at home in bevy_winit. Though that'd mean we can't use bevy_render textures for window icons, but perhaps we shouldn't be doing that anyway. |
I do think it is worthwhile to question the approach. In fact this PR was initially only covering a similar usecase of the old PR and only afterwards I was trying to make it work with Assets. As you have said using Texure was not possible because of cyclic depencencies, so cart came up with the idea that is currently implemented here. (With the downside that my system is checking for icon changes every loop; I dont think that was his intention :D) I guess it might be possible to remove the bevy_window dependency from bevy_render, but I am not sure that the motivation for all this work is justified (just to make icons works with textures :D). You mention not using textures - but does that not mean not using bevy_asset? |
What's needed for this to be merged? I could use this feature. |
bevy/crates/bevy_winit/src/lib.rs Line 47 in cba2b2e
Is If we can't always guarantee this, I'd suggest we add an While this isn't an issue specific to this PR - in fact this PR will help prevent this mistake - I'd like to be doubly sure no one else needs to debug this issue in the future😆. An assert that is almost never triggered but can panic, is way better than mysterious intermittent application hangs. |
Now yes, in the future maybe. See #3973 for my thoughts on how we could evolve the API. TL;DR: I think we need to split "main thread" from "not send and sync", where the former is a special case of the latter.
I approve of this! |
If #4027 is merged, it would resolve this issue because it would force the world.get_non_send::<WinitWindows>().unwrap(); instead of world.get_resource::<WinitWindows>().unwrap(); |
This seems done? There are some conflicts, but I can't seem to find any "github conflict ui" here anymore. |
@janus-culsans @lukors this PR seems relatively abandoned (sorry for the long limbo); if one of you are interested, pulling up a new rebased PR with a link to this thread and credit to @KirmesBude would help move this along. |
Yes, I would be interested. Working on rebasing. |
This pr is from before license change so it can't be used as a basis... you would pretty much have to not look at its code to redo it |
I can't even merge their branch into a new fork with attribution, even though it was MIT before? Now that's funny. |
yes, the repo is now dual licensed MIT / Apache 2, so merging this PR would change its license without the author authorisation. It's 238 lines, so probably not completely trivial, so it would need to be recoded without knowledge of the initial PR |
Closing this out; I don't think we're getting a relicense at this point and it's better to avoid misleading folks. |
Would it make sense to ask for relicense in all S-Pre-Relicense issues now, to avoid this problem from happening again and to give some time to the initial contributors? |
I think all PR authors were pinged several time at the relicensing time... you could try pinging them again, maybe they are active again after a few months of inactivity. The issue to comment on is #2373 |
Based on the following comment, is anyone able to reopen this PR now @mockersf @alice-i-cecile ? |
I can reopen it now that the licensing is cleared up, but I'd prefer #5488 as we'll likely need a bit more back-and-forth :) |
Adds the ability to set the window icon at runtime.
resolves #1031
based on feedback from this PR: #1163
window_icon.webm.mp4
Notes: since there was some confusion, winit does support changing the window icon at runtime.
Outstanding work: