mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-17 23:55:04 +00:00
- Implement generic trackball settings - Refactor T-Deck trackball driver into generic driver at `Drivers/gpio-trackball-module` - Automatically bind/unbind trackball devices with LVGL - Automatically load settings for trackball devices on boot
27 lines
862 B
C
27 lines
862 B
C
#pragma once
|
|
|
|
#include <new>
|
|
|
|
struct Device;
|
|
|
|
/**
|
|
* Common driver-data wrapper attached to every LVGL display/indev created by this module: bundles
|
|
* the kernel Device* with an optional device-type-specific context blob (LvglDisplayCtx,
|
|
* LvglPointerCtx, LvglTrackballCtx, ...), so each device type doesn't have to store its own Device*
|
|
* redundantly. Owns context: any resources referenced through it (buffers, cursor objects, etc.)
|
|
* must be released by the caller before the wrapper is deleted, since context is trivially
|
|
* destructible and only its own memory is freed here.
|
|
*/
|
|
struct LvglDeviceContext {
|
|
struct Device* device = nullptr;
|
|
void* context;
|
|
|
|
explicit LvglDeviceContext(void* context) : context(context) {}
|
|
|
|
~LvglDeviceContext() {
|
|
if (context != nullptr) {
|
|
::operator delete(context);
|
|
}
|
|
}
|
|
};
|