mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-17 23:55:04 +00:00
Fix for trackball
This commit is contained in:
parent
c9452b8aeb
commit
1d0aea255c
@ -72,6 +72,9 @@
|
||||
|
||||
## Lower Priority
|
||||
|
||||
- lvgl-module has a keyboard.cpp that creates a `keyboard_group`. This group is set as the default group, so it can also work with trackball(= LVGL "encoder").
|
||||
Make a separate group that is the default group. The keyboard can then use it (or use its own).
|
||||
The basic idea is to invert the ownership: now the keyboard group is made the default group, but it's probably more logical to have the default group used by the keyboard.
|
||||
- lvgl-module's spinner relies on hard-coded spinner asset from Tactility main project.
|
||||
- Localize all apps
|
||||
- Support hot-plugging SD card (note: this is not possible if they require the CS pin hack)
|
||||
|
||||
@ -19,6 +19,10 @@ void lvgl_keyboard_on_start_lvgl() {
|
||||
lvgl_lock();
|
||||
keyboard_group = lv_group_create();
|
||||
check(keyboard_group);
|
||||
// We currently set this group as the default, so it doesn't only get (manually added) textareas,
|
||||
// but gets all widgets by default. This is a temporary work-around until a proper default group is
|
||||
// created to fix the trackball issue (see trackball.cpp and ideas.md, search for "group")
|
||||
lv_group_set_default(keyboard_group);
|
||||
lvgl_unlock();
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/devices/trackball.h>
|
||||
#include <lvgl/devices/device_context.h>
|
||||
#include <lvgl/devices/keyboard.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <tactility/drivers/trackball.h>
|
||||
@ -154,6 +155,13 @@ error_t lvgl_trackball_add(struct Device* device, lv_display_t* display, lv_inde
|
||||
}
|
||||
recenter_cursor(ctx, indev);
|
||||
|
||||
// Encoder indevs are useless without a group (LVGL dispatch bails out immediately if indev->group is NULL)
|
||||
// Use the keyboard group for now, until it's refactored into a proper global/shared group. See ideas.md
|
||||
// When refactoring this, you probably want to remove the calls to lvgl_keyboard_* below.
|
||||
if (ctx->settings.mode == LVGL_TRACKBALL_MODE_ENCODER) {
|
||||
lvgl_keyboard_enable(indev);
|
||||
}
|
||||
|
||||
*out_indev = indev;
|
||||
return ERROR_NONE;
|
||||
}
|
||||
@ -196,12 +204,14 @@ error_t lvgl_trackball_set_settings(lv_indev_t* indev, const struct LvglTrackbal
|
||||
|
||||
if (mode_changed) {
|
||||
if (settings->mode == LVGL_TRACKBALL_MODE_POINTER) {
|
||||
lvgl_keyboard_disable(indev);
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
|
||||
recenter_cursor(ctx, indev);
|
||||
show_cursor(ctx, indev);
|
||||
} else {
|
||||
hide_cursor(ctx);
|
||||
lv_indev_set_type(indev, LV_INDEV_TYPE_ENCODER);
|
||||
lvgl_keyboard_enable(indev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user