mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-10-24 02:02:25 +00:00
Long-press blanks screen unless actively browsing a list
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.
This commit is contained in:
1 parent
e258644671
commit
429a578cfd
3 files changed
+9
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in new issue
Block a user