Skip to content
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

Add the request_timer method to LifeCycleCtx. #954

Merged
merged 2 commits into from
May 17, 2020

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented May 17, 2020

This PR adds the request_timer method to LifeCycleCtx which will allow to fix the Scroll widget as explained in #834.

To achieve this I had to introduce the WindowHandle pointer to both LifeCycleCtx and LayoutCtx.

@xStrom xStrom added the S-needs-review waits for review label May 17, 2020
Copy link
Collaborator

@luleyleo luleyleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that it already had request_anim_frame but not request_timer 🤔
Seems like a great addition!

@luleyleo luleyleo removed the S-needs-review waits for review label May 17, 2020
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question but looks good modulo the CI issue.

} else {
let mut base_state = BaseState::new(self.root.id());
let mut ctx = LifeCycleCtx {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I think I'm missing the reason we can't reuse the context here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the borrow checker. LifeCycleCtx holds an immutable reference to self while do_anim_frame wants a mutable reference to self.

@xStrom xStrom merged commit 4af2709 into linebender:master May 17, 2020
@xStrom xStrom deleted the lifecycle-timer branch May 17, 2020 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants