Skip to content

Add the request_timer method to LifeCycleCtx.#954

Merged
xStrom merged 2 commits intolinebender:masterfrom
xStrom:lifecycle-timer
May 17, 2020
Merged

Add the request_timer method to LifeCycleCtx.#954
xStrom merged 2 commits intolinebender:masterfrom
xStrom:lifecycle-timer

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
@xStrom xStrom force-pushed the lifecycle-timer branch from fe2f89e to 744a408 Compare May 17, 2020 13:44
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.

self.do_anim_frame(queue, data, env)
} 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