From 429a578cfd445607457ed67def93e61b24a0c2d9 Mon Sep 17 00:00:00 2001 From: drkhsh Date: Sun, 26 Apr 2026 23:08:42 +0200 Subject: [PATCH] Long-press blanks screen unless actively browsing a list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contacts/Messages/Nodes screens consumed long-press as soon as they loaded, which surfaced delete/menu dialogs instead of blanking the display. Gate per-screen long-press consumption on _focusActive so the delete affordance only fires after the user has navigated into the list with up/down/enter. From the resting tab view, long-press falls through to main.cpp and powers the screen off — same behaviour as the home screen. --- src/ui/screens/LvContactsScreen.cpp | 3 +++ src/ui/screens/LvMessagesScreen.cpp | 3 +++ src/ui/screens/LvNodesScreen.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/ui/screens/LvContactsScreen.cpp b/src/ui/screens/LvContactsScreen.cpp index 0688d8b..bfc102a 100644 --- a/src/ui/screens/LvContactsScreen.cpp +++ b/src/ui/screens/LvContactsScreen.cpp @@ -119,6 +119,9 @@ void LvContactsScreen::rebuildList() { bool LvContactsScreen::handleLongPress() { if (!_am || _contactIndices.empty()) return false; + // Only consume long-press once the user has actively navigated into + // the list. Otherwise let main.cpp blank the screen. + if (!_focusActive) return false; lv_obj_t* focused = lv_group_get_focused(LvInput::group()); if (!focused) return false; _deleteIdx = (int)(intptr_t)lv_obj_get_user_data(focused); diff --git a/src/ui/screens/LvMessagesScreen.cpp b/src/ui/screens/LvMessagesScreen.cpp index 53ba059..32e9c76 100644 --- a/src/ui/screens/LvMessagesScreen.cpp +++ b/src/ui/screens/LvMessagesScreen.cpp @@ -185,6 +185,9 @@ int LvMessagesScreen::getFocusedPeerIdx() const { bool LvMessagesScreen::handleLongPress() { if (!_lxmf) return false; + // Only consume long-press once the user has actively navigated into + // the list. Otherwise let main.cpp blank the screen. + if (!_focusActive) return false; int idx = getFocusedPeerIdx(); if (idx < 0 || idx >= (int)_sortedPeers.size()) return false; _lpPeerIdx = idx; diff --git a/src/ui/screens/LvNodesScreen.cpp b/src/ui/screens/LvNodesScreen.cpp index c6044d1..7cfd3d7 100644 --- a/src/ui/screens/LvNodesScreen.cpp +++ b/src/ui/screens/LvNodesScreen.cpp @@ -324,6 +324,9 @@ void LvNodesScreen::updateNicknameDisplay() { bool LvNodesScreen::handleLongPress() { if (!_am) return false; + // Only consume long-press once the user has actively navigated into + // the list. Otherwise let main.cpp blank the screen. + if (!_focusActive) return false; int nodeIdx = getFocusedNodeIdx(); if (nodeIdx < 0 || nodeIdx >= (int)_am->nodes().size()) return false; const auto& node = _am->nodes()[nodeIdx];