mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibGUI: Allow widgets to make themselves non-auto-focusable
This patchs adds a way for widgets exclude themselves from being a focus candidate in Window::focus_a_widget_if_possible(). This is to allow the URL box to not get auto-focused when the browser is loaded.
This commit is contained in:
parent
6f19bf8501
commit
fbf824a50f
Notes:
sideshowbarker
2024-07-18 05:32:53 +09:00
Author: https://github.com/robryanx 🔰
Commit: fbf824a50f
Pull-request: https://github.com/SerenityOS/serenity/pull/9432
2 changed files with 6 additions and 0 deletions
|
@ -114,6 +114,9 @@ public:
|
|||
String tooltip() const { return m_tooltip; }
|
||||
void set_tooltip(String);
|
||||
|
||||
bool is_auto_focusable() const { return m_auto_focusable; }
|
||||
void set_auto_focusable(bool auto_focusable) { m_auto_focusable = auto_focusable; }
|
||||
|
||||
bool is_enabled() const { return m_enabled; }
|
||||
void set_enabled(bool);
|
||||
|
||||
|
@ -357,6 +360,7 @@ private:
|
|||
bool m_fill_with_background_color { false };
|
||||
bool m_visible { true };
|
||||
bool m_greedy_for_hits { false };
|
||||
bool m_auto_focusable { true };
|
||||
bool m_enabled { true };
|
||||
bool m_updates_enabled { true };
|
||||
bool m_accepts_emoji_input { false };
|
||||
|
|
|
@ -947,6 +947,8 @@ Vector<Widget&> Window::focusable_widgets(FocusSource source) const
|
|||
return IterationDecision::Continue;
|
||||
if (!child.is_enabled())
|
||||
return IterationDecision::Continue;
|
||||
if (!child.is_auto_focusable())
|
||||
return IterationDecision::Continue;
|
||||
collect_focusable_widgets(child);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue