Skip to content

Commit

Permalink
Call focus_changed on clear
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmoulton committed Dec 30, 2023
1 parent 705808b commit 277b3f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl Id {
}

pub fn clear_focus(&self) {
self.add_update_message(UpdateMessage::ClearFocus);
self.add_update_message(UpdateMessage::ClearFocus(*self));
}

pub fn update_context_menu(&self, menu: Box<MenuCallback>) {
Expand Down
2 changes: 1 addition & 1 deletion src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type DeferredUpdateMessages = HashMap<Id, Vec<(Id, Box<dyn Any>)>>;

pub(crate) enum UpdateMessage {
Focus(Id),
ClearFocus,
ClearFocus(Id),
Active(Id),
WindowScale(f64),
Disabled {
Expand Down
3 changes: 2 additions & 1 deletion src/window_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,9 @@ impl WindowHandle {
cx.app_state.focus_changed(old, cx.app_state.focus);
}
}
UpdateMessage::ClearFocus => {
UpdateMessage::ClearFocus(id) => {
cx.app_state.clear_focus();
cx.app_state.focus_changed(Some(id), None);
}
UpdateMessage::Active(id) => {
let old = cx.app_state.active;
Expand Down

0 comments on commit 277b3f6

Please sign in to comment.