Skip to content

Commit

Permalink
Call update on Painter from Container
Browse files Browse the repository at this point in the history
This would cause painter to not invalidate as expected.

- fixes #988
  • Loading branch information
cmyr committed May 26, 2020
1 parent 559c534 commit c101ce3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
- Focus request handling is now predictable with the last request overriding earlier ones. ([#948] by [@xStrom])
- Wheel events now properly update hot state. ([#951] by [@xStrom])
- X11: Support mouse scrolling. ([#961] by [@jneem])
- Painter widget not repainting on data change in Container ([#991] by [@cmyr])

### Visual

Expand Down Expand Up @@ -231,6 +232,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
[#970]: https://github.com/xi-editor/druid/pull/970
[#980]: https://github.com/xi-editor/druid/pull/980
[#982]: https://github.com/xi-editor/druid/pull/982
[#991]: https://github.com/xi-editor/druid/pull/991

## [0.5.0] - 2020-04-01

Expand Down
5 changes: 4 additions & 1 deletion druid/src/widget/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ impl<T: Data> Widget<T> for Container<T> {
self.inner.lifecycle(ctx, event, data, env)
}

fn update(&mut self, ctx: &mut UpdateCtx, _old_data: &T, data: &T, env: &Env) {
fn update(&mut self, ctx: &mut UpdateCtx, old_data: &T, data: &T, env: &Env) {
if let Some(BackgroundBrush::Painter(p)) = self.background.as_mut() {
p.update(ctx, old_data, data, env);
}
self.inner.update(ctx, data, env);
}

Expand Down

0 comments on commit c101ce3

Please sign in to comment.