Conversation
|
I was briefly considering if we should wrap
AFAIK you can't implement |
daxpedda
left a comment
There was a problem hiding this comment.
I know the PR isn't ready but I went ahead and implemented Web anyway just to see how everything would work out.
Its a shame about the loss of generics, but again could be resolved by adding a Window type wrapper in the future?
LGTM!
madsmtm
left a comment
There was a problem hiding this comment.
I'm not really in the loop, is the plan to keep the maybe_queue_on_main/maybe_wait_on_main and Send + Sync, or are we getting rid of that?
Because if we're getting rid of it, I'd prefer to do that first, to keep the platform-specific diff smaller (otherwise we'll end up with one commit moving them to web/appkit/uikit, and one commit removing them again, which is a lot of indentation changes).
The plan was to expose |
I think you can keep the diff small, but I can not make the window |
d568280 to
5103e3b
Compare
|
I have no idea whether what I did to |
|
The PR should be ready and every backend is implemented. |
madsmtm
left a comment
There was a problem hiding this comment.
Still a little unsure about the API changes, but let's discuss it synchronously
| let parent_window = self.windows.get(&self.parent_window_id.unwrap()).unwrap(); | ||
| let child_window = spawn_child_window(parent_window, event_loop); | ||
| let child_window = spawn_child_window(parent_window.as_ref(), event_loop); |
There was a problem hiding this comment.
Nit: Use &parent_window to auto-deref the value instead (I think that works, at least)
There was a problem hiding this comment.
Nah, I guess you have to do exactly the same as we do with the ApplicationHandler and all the generic impls over there, I don't mind them, but I'll leave it to follow-up, since there's a chance that none of these as_ref will be needed once we figure out how we actually store the window for the end user.
src/window.rs
Outdated
| /// creation. | ||
| #[inline] | ||
| pub fn default_attributes() -> WindowAttributes { | ||
| fn default_attributes() -> WindowAttributes |
There was a problem hiding this comment.
This should probably be:
impl dyn Window {
pub fn default_attributes() -> ...
}
// Usage: <dyn Window>::default_attributes()Or just removed entirely
|
|
||
| self.window.maybe_queue_on_main(move |w| w.set_outer_position(position)) | ||
| } | ||
| fn set_outer_position(&self, position: Position); |
There was a problem hiding this comment.
Really quite unfortunate that we loose the ability to have impl Into<...> parameters.
I feel like there's ways that we could probably make it work, my initial attempt is here, I'll also link the explanation for erased-serde, there might be some useful information in there.
There was a problem hiding this comment.
I think I'll leave it if it really become a problem, but nice to remember.
97f4c74 to
1644c06
Compare
1644c06 to
6f3d1f8
Compare
This should allow us to make future split of backends much easier. The `Box<dyn Window>` is a _temporary_ solution, which will be removed with the future updates when we decide on how the Window should be stored.
6f3d1f8 to
c11e088
Compare
--
The only issue right now is how to deal with
maybe_queue_on_mainandmaybe_block_on_main. From what I can say the backends should do that themselves for the time being, since it's a temporary peace unless we remove theSendandSyncfrom the window.I've only did the Wayland backend and
examples/window.rsto show how it may look.I'd assume @daxpedda will do for
MonitorHandle(trait is not really needed since data is used) and after that it should be pretty much ready to split backends.The only issue I see is that we can not use generics, since they prevent object safety.
The
Dropimpl we had should also be done for backends, since it's a backend specific behavior and clearly not needed on most of the backends. Though, I've kept it to simple not forget about it.Part of #3433.