Store focus handles in AppContext instead of Window (#22158)

Previously, each window stored its own collection of focus handles. This
meant that to create a focus handle, you needed to have access to a
Window. I'm working on a simplification to gpui's context types that
removes `WindowContext` and `ViewContext` in favor of passing a window
reference explicitly when rendering or handling events. You'll still
need a window to manipulate focus, but it will be helpful to be able to
create focus handles without a window.

cc @mgsloan 

Release Notes:

- N/A
This commit is contained in:
Nathan Sobo 2024-12-17 14:41:00 -07:00 committed by GitHub
parent e1ca5ed836
commit 81c118d67d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 40 deletions

View file

@ -500,7 +500,7 @@ impl AnyElement {
if !focus_assigned {
if let Some(focus_id) = cx.window.next_frame.focus {
return FocusHandle::for_id(focus_id, &cx.window.focus_handles);
return FocusHandle::for_id(focus_id, &cx.focus_handles);
}
}