diff --git a/Makefile b/Makefile index c3315f9..e38bdf8 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ NAME := buckle SRC := main.c VERSION := 1.5.1 -PATH_AUDIO ?= "./wav" +PATH_AUDIO ?= $(shell realpath ./wav) CFLAGS ?= -O3 -g LDFLAGS ?= -g diff --git a/scan-libinput.c b/scan-libinput.c index b503e9a..daeba35 100644 --- a/scan-libinput.c +++ b/scan-libinput.c @@ -43,6 +43,15 @@ static void handle_key(struct libinput_event *ev) play(key, state == LIBINPUT_KEY_STATE_PRESSED); } +static void handle_click(struct libinput_event *ev) +{ + struct libinput_event_pointer *k = libinput_event_get_pointer_event(ev); + enum libinput_button_state state = libinput_event_pointer_get_button_state(k); + uint32_t key = 0xff; + + play(key, state == LIBINPUT_BUTTON_STATE_PRESSED); +} + static void handle_events(struct libinput *li) { struct libinput_event *ev; @@ -55,6 +64,9 @@ static void handle_events(struct libinput *li) case LIBINPUT_EVENT_KEYBOARD_KEY: handle_key(ev); break; + case LIBINPUT_EVENT_POINTER_BUTTON: + handle_click(ev); + break; default: break; }