Conversation
waywardmonkeys
left a comment
There was a problem hiding this comment.
Some initial comments...
masonry/src/contexts.rs
Outdated
| use std::time::Duration; | ||
|
|
||
| use accesskit::{NodeBuilder, TreeUpdate}; | ||
| use kurbo::Vec2; |
There was a problem hiding this comment.
use crate::kurbo::Vec2 ?
There was a problem hiding this comment.
I think it doesn't make a difference, they resolve to the same symbol. (Otherwise I think rustc would complain.)
I don't know if we have a coding style for this, but either way, we're already using both versions throughout Masonry, so I'll keep the ones you pointed out as-is.
| /// Request a compose pass. | ||
| /// | ||
| /// The compose pass is often cheaper than the layout pass, because it can only transform individual widgets' position. | ||
| /// [`compose`]: crate::Widget::compose |
There was a problem hiding this comment.
There's no thing above this that this would be providing a link target for.
There was a problem hiding this comment.
Hmm the Link seems still not to be working using cargo doc --no-deps
masonry/src/passes/compose.rs
Outdated
| // Copyright 2024 the Xilem Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| use kurbo::{Point, Vec2}; |
There was a problem hiding this comment.
use crate::kurbo... again
There was a problem hiding this comment.
Won't fix, see other comment.
| panic!( | ||
| "Error in '{}' #{}: cannot find child #{} returned by children_ids()", | ||
| parent_name, | ||
| parent_id.to_raw(), |
There was a problem hiding this comment.
Should there be a Display or Debug impl for WidgetId?
There was a problem hiding this comment.
Sure, but that's a future PR.
masonry/src/widget/widget_state.rs
Outdated
|
|
||
| use std::sync::atomic::{AtomicBool, Ordering}; | ||
|
|
||
| use kurbo::Vec2; |
There was a problem hiding this comment.
use crate::kurbo::Vec2;
There was a problem hiding this comment.
Actually, can combine with the import below.
There was a problem hiding this comment.
(I mean it's just a nit, but I agree, it's slightly cleaner, same for the other use comments here)
There was a problem hiding this comment.
Won't fix, see other comment.
There was a problem hiding this comment.
We should probably generally find a unique style in the future, just to be consistent.
There was a problem hiding this comment.
We've had an agreement in the past in #223, but I needed to rebase it and it slipped through the cracks.
I've resurrected it.
There was a problem hiding this comment.
Now that #223 is in, this should become a use vello::kurbo::…
6346f72 to
188c594
Compare
DJMcNab
left a comment
There was a problem hiding this comment.
It's hard to judge exactly what this is doing with no widgets actually using it...
Code seems about as expected, I believe.
| pub(crate) is_portal: bool, | ||
|
|
||
| pub(crate) request_compose: bool, | ||
| // TODO - Handle matrix transforms |
There was a problem hiding this comment.
Matrices are tricky with text, due to optical size of text (which we don't yet handle). I think changing the scale of a child can only correctly happen in layout
There was a problem hiding this comment.
I'm leaving that debate for once we do a complete layout refactor.
|
I think this is ready to merge? |
Philipp-M
left a comment
There was a problem hiding this comment.
(I think there are a few unhandled review comments yet (apart from mine)?)
masonry/src/widget/widget_state.rs
Outdated
|
|
||
| use std::sync::atomic::{AtomicBool, Ordering}; | ||
|
|
||
| use kurbo::Vec2; |
There was a problem hiding this comment.
(I mean it's just a nit, but I agree, it's slightly cleaner, same for the other use comments here)
DJMcNab
left a comment
There was a problem hiding this comment.
I think the old ParentWindowOrigin code can be removed now?
I would much prefer that to happen in this PR if so.
| self.children.id.unwrap() | ||
| } | ||
|
|
||
| /// Returns a shared token equivalent to this one. |
There was a problem hiding this comment.
Shared doesn't seem quite right, given that ArenaRef cannot be copied (etc.). That is, ArenaRef does not appear to have any additional abilities over ArenaMut, except for being passed to methods which accept ArenaRef.
This method also doesn't seem to be used?
There was a problem hiding this comment.
Shared doesn't seem quite right, given that ArenaRef cannot be copied
Well now it can =P
This method also doesn't seem to be used?
Yeah, but I'm writing this as though it was a public crate.
masonry/src/widget/widget_pod.rs
Outdated
| InternalLifeCycle::ParentWindowOrigin { .. } => { | ||
| state.parent_window_origin = parent_ctx.widget_state.window_origin(); | ||
| state.needs_window_origin = false; | ||
| // FIXME |
There was a problem hiding this comment.
Does this event need to be removed?
|
I've done some small fixes to address code review. Next step is removing |
|
I believe this is ready to merge. |
|
We should probably merge #223 first, then rebase this on top of it. |
5334339 to
136e54a
Compare
Done. I believe this addresses all code review points. |
DJMcNab
left a comment
There was a problem hiding this comment.
This is compelling! It's really nice to see the back of the parent window origin things
|
... It just now occurs to me, as I start the paint pass, that I completely forgot to hook composition with the Scene transforms. We didn't catch it because widgets don't use the pass yet. Oh well, I'll hook it up with the Portal widget while I implement the paint pass. |
Add
Widget::composemethod.Add
ComposeCtxtype.Add
needs_compose,request_compose,translation_changedflags to WidgetState.Add
window_originattribute to WidgetState.Add convenience methods to TreeArena.
Remove
needs_window_originflag andparent_window_originattribute.