mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 14:37:43 +00:00
LibGUI: Allow widgets to opt-out from showing the command palette
This commit is contained in:
parent
a4cb6a49ae
commit
bf4328de52
2 changed files with 6 additions and 1 deletions
|
@ -283,6 +283,9 @@ public:
|
|||
void set_accepts_emoji_input(bool b) { m_accepts_emoji_input = b; }
|
||||
bool accepts_emoji_input() const { return m_accepts_emoji_input; }
|
||||
|
||||
void set_accepts_command_palette(bool b) { m_accepts_command_palette = b; }
|
||||
bool accepts_command_palette() const { return m_accepts_command_palette; }
|
||||
|
||||
virtual Gfx::IntRect children_clip_rect() const;
|
||||
|
||||
AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> override_cursor() const { return m_override_cursor; }
|
||||
|
@ -378,6 +381,7 @@ private:
|
|||
bool m_enabled { true };
|
||||
bool m_updates_enabled { true };
|
||||
bool m_accepts_emoji_input { false };
|
||||
bool m_accepts_command_palette { true };
|
||||
bool m_shrink_to_fit { false };
|
||||
bool m_default_font { true };
|
||||
|
||||
|
|
|
@ -196,7 +196,8 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3
|
|||
}
|
||||
|
||||
// FIXME: This shortcut should be configurable.
|
||||
if (!m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) {
|
||||
bool focused_widget_accepts_command_palette = window->focused_widget() && window->focused_widget()->accepts_command_palette();
|
||||
if (focused_widget_accepts_command_palette && !m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) {
|
||||
auto command_palette = CommandPalette::construct(*window);
|
||||
TemporaryChange change { m_in_command_palette, true };
|
||||
if (command_palette->exec() != GUI::Dialog::ExecOK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue