You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apps/app-lifecycle.md
+1-28Lines changed: 1 addition & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,34 +219,7 @@ Activity Stack:
219
219
220
220
### Disabling Navigation Globally
221
221
222
-
Apps that need full control over the back and menu buttons can disable the system-level actions globally via `InputManager`:
223
-
224
-
```python
225
-
from mpos.ui.input_manager import InputManager
226
-
227
-
# Disable back-screen navigation (hardware back button, swipe-back gesture)
228
-
InputManager.set_back_screen_disabled(True)
229
-
230
-
# Disable top-menu drawer opening (hardware menu button, swipe-down gesture)
231
-
InputManager.set_drawer_open_disabled(True)
232
-
233
-
# Query current state
234
-
ifnot InputManager.is_back_screen_disabled():
235
-
InputManager.set_back_screen_disabled(True)
236
-
```
237
-
238
-
The same functions are also available as top-level `mpos` imports:
239
-
240
-
```python
241
-
import mpos
242
-
mpos.set_back_screen_disabled(True)
243
-
mpos.set_drawer_open_disabled(True)
244
-
```
245
-
246
-
-`close_drawer()` still works when drawer opening is disabled — you can close an already-open drawer.
247
-
-`finish_current_activity()` (called directly) is not gated, only `back_screen()`.
248
-
- All paths — hardware key handlers, gesture navigation, and programmatic calls — funnel through `back_screen()` and `open_drawer()`/`toggle_drawer()`, so a single call gates every trigger.
249
-
- When disabled, the back-screen and drawer-open actions invoke optional callbacks passed to `set_back_screen_disabled(True, cb=...)` and `set_drawer_open_disabled(True, cb=...)`. The callbacks receive no arguments. If no callback is set, the action is silently consumed.
222
+
Apps that need full control over the back and menu buttons can disable system-level navigation globally. See the [InputManager navigation gating](../frameworks/input-manager.md#navigation-gating) documentation.
Copy file name to clipboardExpand all lines: docs/frameworks/input-manager.md
+58-3Lines changed: 58 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ InputManager centralizes all input-related operations in a single class with cla
11
11
-**Testable** - InputManager can be tested independently
12
12
-**Pointer Access** - Get current touch/pointer coordinates
13
13
-**Device Registration** - Register and query available input devices by type
14
+
-**Navigation Gating** - Disable system-level back and drawer-open actions globally
15
+
-**Touch Feedback** - Attach haptic/touch-feedback callbacks to pointer devices
14
16
15
17
## Architecture
16
18
@@ -87,16 +89,69 @@ Check if any registered input device is a pointer/touch device.
87
89
**Returns:** bool - True if a pointer device is registered
88
90
89
91
#### `emulate_focus_obj(focusgroup, target)`
90
-
Deprecated compatibility shim. Use `lv.group_focus_obj(target)` directly.
92
+
**Deprecated.** Compatibility shim. Use `lv.group_focus_obj(target)` directly.
91
93
92
94
#### `register_indev(indev)`
93
-
Register an input device for later querying by type.
95
+
Register an input device for later querying by type. Called by board initialization code.
96
+
97
+
#### `unregister_indev(indev)`
98
+
Unregister an input device. Disables the device (`indev.enable(False)`) and removes it from the registry.
94
99
95
100
#### `list_indevs()`
96
101
Get list of all registered input devices.
97
102
98
103
#### `has_indev_type(indev_type)`
99
-
Check if any registered input device has the specified type.
104
+
Check if any registered input device has the specified type (e.g., `lv.INDEV_TYPE.KEYPAD`, `lv.INDEV_TYPE.POINTER`).
105
+
106
+
#### `has_haptic_feedback()`
107
+
Check whether touch feedback (haptic) has been set up on pointer devices.
108
+
109
+
**Returns:** bool
110
+
111
+
#### `set_touch_feedback_cb(cb)`
112
+
Attach a callback `cb(event)` to every registered pointer input device on `LV_EVENT.CLICKED`. LVGL sends `CLICKED` on touch release only when the press did not scroll a scrollable parent, so the callback fires on taps but not on swipes. Call once at boot; calling again re-registers the callback.
113
+
114
+
## Navigation Gating
115
+
116
+
Apps that need full control over the back and menu buttons can disable system-level navigation actions globally via InputManager:
117
+
118
+
```python
119
+
from mpos.ui.input_manager import InputManager
120
+
import mpos
121
+
122
+
InputManager.set_back_screen_disabled(True)
123
+
InputManager.set_drawer_open_disabled(True)
124
+
125
+
ifnot InputManager.is_back_screen_disabled():
126
+
InputManager.set_back_screen_disabled(True)
127
+
```
128
+
129
+
The same functions are also available as top-level `mpos` imports:
130
+
131
+
```python
132
+
import mpos
133
+
mpos.set_back_screen_disabled(True)
134
+
mpos.set_drawer_open_disabled(True)
135
+
```
136
+
137
+
-`close_drawer()` still works when drawer opening is disabled — you can close an already-open drawer.
138
+
-`finish_current_activity()` (called directly) is not gated, only `back_screen()`.
139
+
- All paths — hardware key handlers, gesture navigation, and programmatic calls — funnel through `back_screen()` and `open_drawer()`/`toggle_drawer()`, so a single call gates every trigger.
140
+
- When disabled, the back-screen and drawer-open actions invoke optional callbacks passed to `set_back_screen_disabled(True, cb=...)` and `set_drawer_open_disabled(True, cb=...)`. The callbacks receive no arguments. If no callback is set, the action is silently consumed.
0 commit comments