power_gesture
#include "crosspad-gui/components/power_gesture.h"Generated from crosspad-gui/components/power_gesture.h in crosspad-gui. Edit the header’s doxygen comments to change this page.
Portable resolution of the hardware power button’s two GUI gestures.
Recipes that use it: UI kit
Functions
Section titled “Functions”backResultName
Section titled “backResultName”const char * backResultName(BackResult r)Declared in crosspad-gui/components/power_gesture.h:33.
ui_back_push
Section titled “ui_back_push”uint32_t ui_back_push(BackHandlerFn fn, void *user_data)Register a dismissable overlay.
Returns a token, or 0 when the stack is full. The most recently pushed handler is asked first.
Used in UI kit.
Declared in crosspad-gui/components/power_gesture.h:42.
ui_back_remove
Section titled “ui_back_remove”void ui_back_remove(uint32_t token)Drop a registration. Safe to call with 0 or an already-removed token.
Used in UI kit.
Declared in crosspad-gui/components/power_gesture.h:45.
ui_back_has_overlay
Section titled “ui_back_has_overlay”bool ui_back_has_overlay()True while at least one overlay is registered.
Declared in crosspad-gui/components/power_gesture.h:48.
powerBack
Section titled “powerBack”BackResult powerBack()Contextual “back” — the short click of the power button.
Resolved most-local-first:
- an open dropdown / picker on the focused object → close it
- a registered overlay (modal, confirm box) → cancel it
- the encoder group in edit mode → leave edit mode
- the quick-settings drawer → close it
- a running app → its onBack hook, or close the app and return to the launcher
- the bare launcher → nothing
Declared in crosspad-gui/components/power_gesture.h:64.
powerButtonPress
Section titled “powerButtonPress”void powerButtonPress()Press / release of an emulated power button (the simulator’s on-screen button, a keyboard key, a control-port verb).
Does the same click-vs-hold split the firmware does from its register poll, on an LVGL timer.
Declared in crosspad-gui/components/power_gesture.h:73.
powerButtonRelease
Section titled “powerButtonRelease”void powerButtonRelease()Declared in crosspad-gui/components/power_gesture.h:74.
powerToggleQuickSettings
Section titled “powerToggleQuickSettings”bool powerToggleQuickSettings()Toggle the status-bar quick-settings drawer — the 0.5 s hold.
No-op when the drawer is disabled in settings (no arrow button exists).
Declared in crosspad-gui/components/power_gesture.h:78.
BackResult
Section titled “BackResult”What powerBack() did, for logging and tests.
| Value | Value | Description |
|---|---|---|
None | 0 | nothing was open; the launcher stays as it is |
Dropdown | an open dropdown/picker was closed | |
Overlay | a modal on the overlay layer was cancelled | |
Editing | the encoder group left edit mode | |
Drawer | the quick-settings drawer was closed | |
Transport | the encoder’s focus went back from the top bar to the screen | |
App | the running app handled it, or was closed |
Declared in crosspad-gui/components/power_gesture.h:23.
BackHandlerFn
Section titled “BackHandlerFn”using crosspad_gui::BackHandlerFn = bool (*)(void* user_data)Return true if the handler consumed the gesture (and tore its overlay down).
Declared in crosspad-gui/components/power_gesture.h:38.
Variables
Section titled “Variables”| Declaration | Description |
|---|---|
constexpr uint32_t kPowerHoldMs | The hold threshold both platforms use, and the STM32’s own LONG_PRESS_SLEEP_MS: under it a press is a click, at it the hold fires. |