Skip to content

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

const char * backResultName(BackResult r)

Declared in crosspad-gui/components/power_gesture.h:33.

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.

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.

bool ui_back_has_overlay()

True while at least one overlay is registered.

Declared in crosspad-gui/components/power_gesture.h:48.

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.

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.

void powerButtonRelease()

Declared in crosspad-gui/components/power_gesture.h:74.

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.

What powerBack() did, for logging and tests.

ValueValueDescription
None0nothing was open; the launcher stays as it is
Dropdownan open dropdown/picker was closed
Overlaya modal on the overlay layer was cancelled
Editingthe encoder group left edit mode
Drawerthe quick-settings drawer was closed
Transportthe encoder’s focus went back from the top bar to the screen
Appthe running app handled it, or was closed

Declared in crosspad-gui/components/power_gesture.h:23.

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.

DeclarationDescription
constexpr uint32_t kPowerHoldMsThe 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.