Improve window setting#94
Conversation
hecrj
left a comment
There was a problem hiding this comment.
Thanks for contributing!
I think we can leave the API of the iced crate completely unaffected by this, at least for now.
For the second case you mention, the use case in #50 is definitely related. We should try to come up with a solution for both. I believe there should be a way to split iced_winit functionality for advanced needs on native platforms, while keeping iced completely unaffected.
I'd also like to remind you (and others looking to contribute) that I'd love to know about your use cases before we settle on a specific design! As the contributing guide states, we have a Zulip server and you can also find me on Discord.
| #[path = "not_windows.rs"] | ||
| pub mod platform; | ||
|
|
||
| pub use platform::PlatformSpecific; |
There was a problem hiding this comment.
I would only expose PlatformSpecific settings in iced_winit for the time being.
There was a problem hiding this comment.
Sure.
I made iced's platform-specific settings use iced_winit's PlatformSettings.
Make Window.platform_specific use iced_winit::settings::PlatformSpecific
hecrj
left a comment
There was a problem hiding this comment.
Thanks for addressing the feedback! 🎉
I think there is still a detail left to fix, then we can merge this!
| iced_web = { version = "0.1.0", path = "web" } | ||
|
|
||
| [target.'cfg(target_os = "windows")'.dependencies.winapi] | ||
| version = "0.3.6" |
There was a problem hiding this comment.
I think this should not be necessary now.
There was a problem hiding this comment.
Oops, I forgot to remove it.
I've removed now.
| pub decorations: bool, | ||
|
|
||
| /// Platform specific Setting. | ||
| pub platform_specific: iced_winit::settings::PlatformSpecific, |
There was a problem hiding this comment.
The idea is to simply not expose this for now and make advanced users use iced_winit directly instead.
There was a problem hiding this comment.
Make sense!
I've removed extended settings from iced's setting.
| size: settings.window.size, | ||
| resizable: settings.window.resizable, | ||
| decorations: settings.window.decorations, | ||
| platform_specific: settings.window.platform_specific, |
There was a problem hiding this comment.
Then we'll simply use iced_winit::settings::PlatformSpecific::default() here.
hecrj
left a comment
There was a problem hiding this comment.
Thanks for addressing my feedback!
I have changed a couple of details. Let me know if it's okay and we can merge this!
|
Thanks for your work! |
Hi, I'm interested in running iced in vst-rs environment.
For this, there are 2 things to do.
runmethod will not return until close. This behavior is not undesirable.This PR handles 1.
To create a window in VST, we must initialize
winitlike below.To do the same thing in
iced, we need support setting optionswith_decorationsandwith_parent_window.This is what is the PR does.
For
with_decorations, it's just straightforward to implement because it is supported in all platforms inwinit.For
with_parent_windowit's not straightforward sincewith_parent_windowis Windows-specific API.So I introduced a simple platform-specific module to implement.