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

Fix focus on hidden widget in Either #1860

Merged
merged 5 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Garrett Risley
Robert Wittams
Jaap Aarts
Maximilian Köstler
Bruno Dupuis
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ You can find its changes [documented below](#070---2021-01-01).
- X11 backend now supports scaling([#1751] by [@Maan2003])
- X11 backend now supports changing cursors ([#1755] by [@Maan2003])
- X11 backend now uses the platform locale ([#1756] by [@Maan2003])
- `Either` and `Tab` widgets were still propagating events to hidden widgets ([#1860] by [@lisael])

### Visual

Expand Down Expand Up @@ -493,6 +494,7 @@ Last release without a changelog :(
[@r-ml]: https://github.com/r-ml
[@djeedai]: https://github.com/djeedai
[@bjorn]: https://github.com/bjorn
[@lisael]: https://github.com/lisael

[#599]: https://github.com/linebender/druid/pull/599
[#611]: https://github.com/linebender/druid/pull/611
Expand Down Expand Up @@ -744,6 +746,7 @@ Last release without a changelog :(
[#1825]: https://github.com/linebender/druid/pull/1825
[#1843]: https://github.com/linebender/druid/pull/1843
[#1851]: https://github.com/linebender/druid/pull/1851
[#1860]: https://github.com/linebender/druid/pull/1860
[#1861]: https://github.com/linebender/druid/pull/1861
[#1863]: https://github.com/linebender/druid/pull/1863

Expand Down
2 changes: 1 addition & 1 deletion druid/src/widget/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<T: Data> Widget<T> for Either<T> {
let current = (self.closure)(data, env);
if current != self.current {
self.current = current;
ctx.request_layout();
ctx.children_changed();
}
self.current_widget().update(ctx, data, env)
}
Expand Down
6 changes: 1 addition & 5 deletions druid/src/widget/tabs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ impl<TP: TabsPolicy> Widget<TabsState<TP>> for TabBar<TP> {
if let LifeCycle::WidgetAdded = event {
self.ensure_tabs(data);
ctx.children_changed();
ctx.request_layout();
}

for (_, tab) in self.tabs.iter_mut() {
Expand All @@ -397,7 +396,6 @@ impl<TP: TabsPolicy> Widget<TabsState<TP>> for TabBar<TP> {
if data.policy.tabs_changed(&old_data.inner, &data.inner) {
self.ensure_tabs(data);
ctx.children_changed();
ctx.request_layout();
} else if old_data.selected != data.selected {
ctx.request_paint();
}
Expand Down Expand Up @@ -611,7 +609,6 @@ impl<TP: TabsPolicy> Widget<TabsState<TP>> for TabsBody<TP> {
if let LifeCycle::WidgetAdded = event {
self.make_tabs(data);
ctx.children_changed();
ctx.request_layout();
}

if event.should_propagate_to_hidden() {
Expand All @@ -638,7 +635,6 @@ impl<TP: TabsPolicy> Widget<TabsState<TP>> for TabsBody<TP> {
) {
let init = if data.policy.tabs_changed(&old_data.inner, &data.inner) {
ctx.children_changed();
ctx.request_layout();
Some(self.make_tabs(data))
} else {
None
Expand All @@ -648,7 +644,7 @@ impl<TP: TabsPolicy> Widget<TabsState<TP>> for TabsBody<TP> {
self.transition_state = self
.transition
.tab_changed(old_data.selected, data.selected);
ctx.request_layout();
ctx.children_changed();

if self.transition_state.is_some() {
ctx.request_anim_frame();
Expand Down