From 1d2584465d09552a8305be0e6c6359be5fe53d48 Mon Sep 17 00:00:00 2001 From: pablohc Date: Sun, 12 Apr 2026 04:18:36 +0200 Subject: [PATCH] feat(keyboard): add bottom row spacing, vertical offset, and gap adjustments --- src/activities/util/KeyboardEntryActivity.cpp | 9 ++++++--- src/components/themes/BaseTheme.h | 2 ++ src/components/themes/lyra/Lyra3CoversTheme.h | 1 + src/components/themes/lyra/LyraTheme.h | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/activities/util/KeyboardEntryActivity.cpp b/src/activities/util/KeyboardEntryActivity.cpp index f5c750c3..15147c5b 100644 --- a/src/activities/util/KeyboardEntryActivity.cpp +++ b/src/activities/util/KeyboardEntryActivity.cpp @@ -249,8 +249,11 @@ void KeyboardEntryActivity::render(RenderLock&&) { } } - const int bottomRowY = keyboardStartY + contentRows * (keyHeight + keySpacing); - const int bottomKeyWidth = 2 * keyWidth + keySpacing; + const int bottomRowGap = metrics.keyboardBottomKeySpacing > 0 ? 4 : 0; + const int bottomRowY = keyboardStartY + contentRows * (keyHeight + keySpacing) + bottomRowGap; + const int bkSpacing = metrics.keyboardBottomKeySpacing; + const int contentTotalWidth = COLS * keyWidth + (COLS - 1) * keySpacing; + const int bottomKeyWidth = (contentTotalWidth - (BOTTOM_KEY_COUNT - 1) * bkSpacing) / BOTTOM_KEY_COUNT; const int bottomSelectedRow = isBottomRow(selectedRow); struct BottomKeyInfo { @@ -267,7 +270,7 @@ void KeyboardEntryActivity::render(RenderLock&&) { }; for (int i = 0; i < BOTTOM_KEY_COUNT; i++) { - const int keyX = leftMargin + (2 * i) * (keyWidth + keySpacing); + const int keyX = leftMargin + i * (bottomKeyWidth + bkSpacing); const bool isSelected = bottomSelectedRow && i == selectedCol; GUI.drawKeyboardKey(renderer, Rect{keyX, bottomRowY, bottomKeyWidth, keyHeight}, bottomKeys[i].label, isSelected, diff --git a/src/components/themes/BaseTheme.h b/src/components/themes/BaseTheme.h index dd0f7da6..1e2571e8 100644 --- a/src/components/themes/BaseTheme.h +++ b/src/components/themes/BaseTheme.h @@ -60,6 +60,7 @@ struct ThemeMetrics { int keyboardKeyWidth; int keyboardKeyHeight; int keyboardKeySpacing; + int keyboardBottomKeySpacing; bool keyboardBottomAligned; bool keyboardCenteredText; int keyboardVerticalOffset; @@ -101,6 +102,7 @@ constexpr ThemeMetrics values = {.batteryWidth = 15, .keyboardKeyWidth = 22, .keyboardKeyHeight = 30, .keyboardKeySpacing = 10, + .keyboardBottomKeySpacing = 0, .keyboardBottomAligned = true, .keyboardCenteredText = false, .keyboardVerticalOffset = -10}; diff --git a/src/components/themes/lyra/Lyra3CoversTheme.h b/src/components/themes/lyra/Lyra3CoversTheme.h index bfc9ac11..3c17ec86 100644 --- a/src/components/themes/lyra/Lyra3CoversTheme.h +++ b/src/components/themes/lyra/Lyra3CoversTheme.h @@ -36,6 +36,7 @@ constexpr ThemeMetrics values = {.batteryWidth = 16, .keyboardKeyWidth = 31, .keyboardKeyHeight = 50, .keyboardKeySpacing = 0, + .keyboardBottomKeySpacing = 5, .keyboardBottomAligned = true, .keyboardCenteredText = true, .keyboardVerticalOffset = 0}; diff --git a/src/components/themes/lyra/LyraTheme.h b/src/components/themes/lyra/LyraTheme.h index ee2639b6..08f0ebaa 100644 --- a/src/components/themes/lyra/LyraTheme.h +++ b/src/components/themes/lyra/LyraTheme.h @@ -34,9 +34,10 @@ constexpr ThemeMetrics values = {.batteryWidth = 16, .keyboardKeyWidth = 31, .keyboardKeyHeight = 40, .keyboardKeySpacing = 0, + .keyboardBottomKeySpacing = 5, .keyboardBottomAligned = true, .keyboardCenteredText = true, - .keyboardVerticalOffset = -10}; + .keyboardVerticalOffset = -12}; } class LyraTheme : public BaseTheme {