diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-11-30 15:34:08 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-11-30 15:35:19 +0100 |
commit | f8703d44cc00361aa991818dde7fcb4564cf05b9 (patch) | |
tree | 07f77d54fd2e60f1ace1b13ab1c300302d0ad3bc /Applications/TextEditor | |
parent | ee8773c586252d1f29702dc85a6cbcafcdbaff4e (diff) | |
download | serenity-f8703d44cc00361aa991818dde7fcb4564cf05b9.zip |
TextEditor: Focus the editor widget on startup
Diffstat (limited to 'Applications/TextEditor')
-rw-r--r-- | Applications/TextEditor/TextEditorWidget.cpp | 2 | ||||
-rw-r--r-- | Applications/TextEditor/TextEditorWidget.h | 2 | ||||
-rw-r--r-- | Applications/TextEditor/main.cpp | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp index cdf33c7419..27f1fc6595 100644 --- a/Applications/TextEditor/TextEditorWidget.cpp +++ b/Applications/TextEditor/TextEditorWidget.cpp @@ -250,8 +250,6 @@ TextEditorWidget::TextEditorWidget() toolbar->add_action(m_editor->undo_action()); toolbar->add_action(m_editor->redo_action()); - - m_editor->set_focus(true); } TextEditorWidget::~TextEditorWidget() diff --git a/Applications/TextEditor/TextEditorWidget.h b/Applications/TextEditor/TextEditorWidget.h index 208b965931..dbeac28377 100644 --- a/Applications/TextEditor/TextEditorWidget.h +++ b/Applications/TextEditor/TextEditorWidget.h @@ -19,6 +19,8 @@ public: void open_sesame(const String& path); bool request_close(); + GTextEditor& editor() { return *m_editor; } + private: TextEditorWidget(); void set_path(const FileSystemPath& file); diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp index 0b0046b84e..d0354d4353 100644 --- a/Applications/TextEditor/main.cpp +++ b/Applications/TextEditor/main.cpp @@ -12,6 +12,8 @@ int main(int argc, char** argv) auto text_widget = TextEditorWidget::construct(); window->set_main_widget(text_widget); + text_widget->editor().set_focus(true); + window->on_close_request = [&]() -> GWindow::CloseRequestDecision { if (text_widget->request_close()) return GWindow::CloseRequestDecision::Close; |