Merge pull request #518 from martinetd/libinput_config

rootston: add arbitrary libinput config 'tap_enabled'
This commit is contained in:
Drew DeVault 2017-12-24 08:17:41 -08:00 committed by GitHub
commit a081b3bf7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

View File

@ -21,6 +21,7 @@ struct roots_device_config {
char *name; char *name;
char *seat; char *seat;
char *mapped_output; char *mapped_output;
bool tap_enabled;
struct wlr_box *mapped_box; struct wlr_box *mapped_box;
struct wl_list link; struct wl_list link;
}; };

View File

@ -342,6 +342,16 @@ static int config_ini_handler(void *user, const char *section, const char *name,
} else if (strcmp(name, "seat") == 0) { } else if (strcmp(name, "seat") == 0) {
free(dc->seat); free(dc->seat);
dc->seat = strdup(value); dc->seat = strdup(value);
} else if (strcmp(name, "tap_enabled") == 0) {
if (strcasecmp(value, "true") == 0) {
dc->tap_enabled = true;
} else if (strcasecmp(value, "false") == 0) {
dc->tap_enabled = false;
} else {
wlr_log(L_ERROR,
"got unknown tap_enabled value: %s",
value);
}
} else { } else {
wlr_log(L_ERROR, "got unknown device config: %s", name); wlr_log(L_ERROR, "got unknown device config: %s", name);
} }

View File

@ -5,6 +5,7 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/xcursor.h> #include <wlr/xcursor.h>
#include <wlr/xwayland.h> #include <wlr/xwayland.h>
#include <wlr/backend/libinput.h>
#include "rootston/server.h" #include "rootston/server.h"
#include "rootston/config.h" #include "rootston/config.h"
#include "rootston/input.h" #include "rootston/input.h"
@ -60,6 +61,17 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
device->vendor, device->product, device_type(device->type), seat_name); device->vendor, device->product, device_type(device->type), seat_name);
roots_seat_add_device(seat, device); roots_seat_add_device(seat, device);
if (dc && wlr_input_device_is_libinput(device)) {
struct libinput_device *libinput_dev =
wlr_libinput_get_device_handle(device);
wlr_log(L_DEBUG, "input has config, tap_enabled: %d\n", dc->tap_enabled);
if (dc->tap_enabled) {
libinput_device_config_tap_set_enabled(libinput_dev,
LIBINPUT_CONFIG_TAP_ENABLED);
}
}
} }
static void input_remove_notify(struct wl_listener *listener, void *data) { static void input_remove_notify(struct wl_listener *listener, void *data) {

View File

@ -30,6 +30,7 @@ theme = default
map-to-output = VGA-1 map-to-output = VGA-1
# Restrict cursor movements for this mouse to concrete rectangle # Restrict cursor movements for this mouse to concrete rectangle
geometry = 2500x800 geometry = 2500x800
# tap_enabled=true
[keyboard] [keyboard]
meta-key = Logo meta-key = Logo