From 107db38a51d22e77848a7b04909f3ef4eabe2445 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 22 Jul 2020 21:19:34 -0400 Subject: Browser: Focus input text field in JS console by default --- Applications/Browser/ConsoleWidget.cpp | 4 ++++ Applications/Browser/ConsoleWidget.h | 3 +++ 2 files changed, 7 insertions(+) (limited to 'Applications/Browser') diff --git a/Applications/Browser/ConsoleWidget.cpp b/Applications/Browser/ConsoleWidget.cpp index 67759e68a6..459043d991 100644 --- a/Applications/Browser/ConsoleWidget.cpp +++ b/Applications/Browser/ConsoleWidget.cpp @@ -165,4 +165,8 @@ void ConsoleWidget::clear_output() m_output_view->update(); } +void ConsoleWidget::focusin_event(Core::Event&) +{ + m_input->set_focus(true); +} } diff --git a/Applications/Browser/ConsoleWidget.h b/Applications/Browser/ConsoleWidget.h index 9b70deeebd..44a6f881f0 100644 --- a/Applications/Browser/ConsoleWidget.h +++ b/Applications/Browser/ConsoleWidget.h @@ -47,6 +47,9 @@ public: private: ConsoleWidget(); + virtual bool accepts_focus() const override { return true; } + virtual void focusin_event(Core::Event&) override; + RefPtr m_input; RefPtr m_output_view; RefPtr m_output_container; -- cgit v1.2.3