From a7ad0f14bf0860718b01cf09cbac2c7e05902466 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 6 Apr 2021 17:30:49 +0200 Subject: [PATCH] Minesweeper: Fix UI layout and focus behavior Click-to-focus was visually annoying. Switch to tab-to-focus. --- Userland/Games/Minesweeper/Field.cpp | 6 ++++-- Userland/Games/Minesweeper/main.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Userland/Games/Minesweeper/Field.cpp b/Userland/Games/Minesweeper/Field.cpp index a859486884b..e1eb43732e1 100644 --- a/Userland/Games/Minesweeper/Field.cpp +++ b/Userland/Games/Minesweeper/Field.cpp @@ -33,7 +33,6 @@ #include #include #include -#include class SquareButton final : public GUI::Button { C_OBJECT(SquareButton); @@ -56,7 +55,10 @@ public: } private: - SquareButton() { } + SquareButton() + { + set_focus_policy(GUI::FocusPolicy::TabFocus); + } }; class SquareLabel final : public GUI::Label { diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp index d0d09f4c429..8c3835b796c 100644 --- a/Userland/Games/Minesweeper/main.cpp +++ b/Userland/Games/Minesweeper/main.cpp @@ -91,8 +91,9 @@ int main(int argc, char** argv) auto& flag_label = container.add(); auto& face_button = container.add(); + face_button.set_focus_policy(GUI::FocusPolicy::TabFocus); face_button.set_button_style(Gfx::ButtonStyle::CoolBar); - face_button.set_fixed_width(36); + face_button.set_fixed_size(36, 36); auto& time_image = container.add(); time_image.load_from_file("/res/icons/minesweeper/timer.png");