keyboard: add haptic feedback
This commit is contained in:
parent
271cdf8534
commit
6b3477dc78
19 changed files with 211 additions and 15 deletions
|
|
@ -1,3 +1,6 @@
|
|||
[keyboard]
|
||||
haptic_feedback=true
|
||||
|
||||
[theme]
|
||||
default=breezy-light
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,13 @@ static int parsing_handler(void* user_data, const char* section, const char* key
|
|||
static int parsing_handler(void* user_data, const char* section, const char* key, const char* value) {
|
||||
bb_config_opts *opts = (bb_config_opts *)user_data;
|
||||
|
||||
if (strcmp(section, "theme") == 0) {
|
||||
if (strcmp(section, "keyboard") == 0) {
|
||||
if (strcmp(key, "haptic_feedback") == 0) {
|
||||
if (bbx_config_parse_bool(value, &(opts->keyboard.haptic_feedback))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(section, "theme") == 0) {
|
||||
if (strcmp(key, "default") == 0) {
|
||||
bbx_themes_theme_id_t id = bbx_themes_find_theme_with_name(value);
|
||||
if (id != BBX_THEMES_THEME_NONE) {
|
||||
|
|
@ -80,6 +86,7 @@ static int parsing_handler(void* user_data, const char* section, const char* key
|
|||
*/
|
||||
|
||||
void bb_config_init_opts(bb_config_opts *opts) {
|
||||
opts->keyboard.haptic_feedback = true;
|
||||
opts->theme.default_id = BBX_THEMES_THEME_BREEZY_DARK;
|
||||
opts->input.pointer = true;
|
||||
opts->input.touchscreen = true;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@
|
|||
|
||||
#include "sq2lv_layouts.h"
|
||||
|
||||
/**
|
||||
* Options related to the keyboard
|
||||
*/
|
||||
typedef struct {
|
||||
/* If true, vibrate on key presses */
|
||||
bool haptic_feedback;
|
||||
} bb_config_opts_keyboard;
|
||||
|
||||
/**
|
||||
* Options related to the theme
|
||||
*/
|
||||
|
|
@ -43,6 +51,8 @@ typedef struct {
|
|||
* Options parsed from config file(s)
|
||||
*/
|
||||
typedef struct {
|
||||
/* Options related to the keyboard */
|
||||
bb_config_opts_keyboard keyboard;
|
||||
/* Options related to the theme */
|
||||
bb_config_opts_theme theme;
|
||||
/* Options related to input devices */
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
#include "../shared/force_feedback.h"
|
||||
#include "../shared/indev.h"
|
||||
#include "../shared/log.h"
|
||||
#include "../shared/theme.h"
|
||||
|
|
@ -93,6 +94,8 @@ static void keyboard_value_changed_cb(lv_event_t *event) {
|
|||
return;
|
||||
}
|
||||
|
||||
bbx_force_feedback_play();
|
||||
|
||||
if (sq2lv_is_layer_switcher(kb, btn_id)) {
|
||||
pop_checked_modifier_keys();
|
||||
sq2lv_switch_layer(kb, btn_id);
|
||||
|
|
@ -296,7 +299,8 @@ int main(int argc, char *argv[]) {
|
|||
/* Attach input devices and start monitoring for new ones */
|
||||
struct bbx_indev_opts input_config = {
|
||||
.pointer = conf_opts.input.pointer,
|
||||
.touchscreen = conf_opts.input.touchscreen
|
||||
.touchscreen = conf_opts.input.touchscreen,
|
||||
.force_feedback = conf_opts.keyboard.haptic_feedback
|
||||
};
|
||||
if (bbx_indev_init(fd_epoll, &input_config) == 0)
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue