-
Notifications
You must be signed in to change notification settings - Fork 112
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
Implement update_focus pass #538
Conversation
25a3962
to
cc7c698
Compare
if handled == Handled::No | ||
&& key.physical_key == PhysicalKey::Code(KeyCode::Tab) | ||
&& key.state == ElementState::Pressed | ||
{ | ||
if !mods.shift_key() { | ||
root.state.next_focused_widget = root.widget_from_focus_chain(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future PR, but not a big fan of this boolean arg here, would be nicer to have Focus::Next
Focus::Prev
or something instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that part of the code is due for a refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work correctly, as far as I can see.
masonry/src/event.rs
Outdated
@@ -357,6 +349,9 @@ pub enum StatusChange { | |||
/// | |||
/// [`EventCtx::is_focused`]: crate::EventCtx::is_focused | |||
FocusChanged(bool), | |||
|
|||
/// Called when a widget becomes or no longer is parent of a focused widget. | |||
HasFocusChanged(bool), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
ChildFocusChanged(bool),
would be a better name, because HasFocusedChanged
could also be read as "my focus has changed" - indeed, that's how I read it originally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
c0d1c84
to
bc1da54
Compare
d0aa999
to
d88da11
Compare
d88da11
to
ddda94d
Compare
Make Textbox Widget tab-focusable.
This is part of the Pass Specification RFC: linebender/rfcs#7