Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package bucklespring for openSUSE:Factory checked in at 2021-05-04 22:01:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bucklespring (Old) and /work/SRC/openSUSE:Factory/.bucklespring.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bucklespring" Tue May 4 22:01:29 2021 rev:2 rq:890466 version:1.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/bucklespring/bucklespring.changes 2019-01-03 18:09:19.463996666 +0100 +++ /work/SRC/openSUSE:Factory/.bucklespring.new.2988/bucklespring.changes 2021-05-04 22:01:42.860437156 +0200 @@ -1,0 +2,16 @@ +Mon May 3 13:20:36 UTC 2021 - Martin Hauke <mar...@gmx.de> + +- Update to version 1.5.0 + * scan-x11: Play mouse clicks both on press and release + * Add desktop file + * Adds background in starting tool + * Added libinput scan backend + * Add a array to configure mid row location and solve stereo + issues + * Adjusted gain of new numpad keys by -4dB to match average + volume of existing keys + * Add horizontal locations for keypad keys + * Add (normalized) keypad samples + * Misc bugfixes + +------------------------------------------------------------------- Old: ---- bucklespring-1.4.0.tar.gz New: ---- bucklespring-1.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bucklespring.spec ++++++ --- /var/tmp/diff_new_pack.Mk1DQV/_old 2021-05-04 22:01:43.332435382 +0200 +++ /var/tmp/diff_new_pack.Mk1DQV/_new 2021-05-04 22:01:43.336435367 +0200 @@ -1,7 +1,8 @@ # # spec file for package bucklespring # -# Copyright (c) 2019, Martin Hauke <mar...@gmx.de> +# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2019-2021, Martin Hauke <mar...@gmx.de> # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,19 +13,19 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: bucklespring -Version: 1.4.0 +Version: 1.5.0 Release: 0 Summary: Nostalgia keyboard sound emulator License: GPL-2.0-only Group: Amusements/Toys/Other URL: https://github.com/zevv/bucklespring #Git-Clone: https://github.com/zevv/bucklespring.git -Source: https://github.com/zevv/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source: https://github.com/zevv/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: fdupes BuildRequires: pkgconfig BuildRequires: pkgconfig(alure) @@ -41,12 +42,13 @@ %build export CFLAGS='%{optflags}' -make PATH_AUDIO=%{_datadir}/bucklespring/wav/ %{?_smp_mflags} +%make_build PATH_AUDIO=%{_datadir}/bucklespring/wav/ %install install -Dm 0755 buckle %{buildroot}/%{_bindir}/buckle install -d %{buildroot}/%{_datadir}/%{name}/wav install -m 0644 wav/* %{buildroot}/%{_datadir}/%{name}/wav +install -D -m 0644 buckle.desktop %{buildroot}%{_datadir}/applications/buckle.desktop %fdupes -s %{buildroot}/%{_datadir}/%{name}/wav %files @@ -55,5 +57,6 @@ %{_bindir}/buckle %dir %{_datadir}/%{name} %{_datadir}/%{name}/wav +%{_datadir}/applications/buckle.desktop %changelog ++++++ bucklespring-1.4.0.tar.gz -> bucklespring-1.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/.gitignore new/bucklespring-1.5.0/.gitignore --- old/bucklespring-1.4.0/.gitignore 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/.gitignore 2021-01-21 12:54:15.000000000 +0100 @@ -1,4 +1,5 @@ *.swp *.o +*.exe cscope.out buckle diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/Makefile new/bucklespring-1.5.0/Makefile --- old/bucklespring-1.4.0/Makefile 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/Makefile 2021-01-21 12:54:15.000000000 +0100 @@ -1,49 +1,57 @@ NAME := buckle -SRC := main.c scan-linux.c scan-windows.c scan-mac.c +SRC := main.c VERSION := 1.4.0 PATH_AUDIO ?= "./wav" -CFLAGS += $(CPPFLAGS) +CFLAGS ?= -O3 -g +LDFLAGS ?= -g CFLAGS += -Wall -Werror CFLAGS += -DVERSION=\"$(VERSION)\" CFLAGS += -DPATH_AUDIO=\"$(PATH_AUDIO)\" -CFLAGS += -O3 -g -LDFLAGS += -g ifdef mingw BIN := $(NAME).exe CROSS := i686-w64-mingw32- CFLAGS += -Iwin32/include -Iwin32/include/AL LDFLAGS += -mwindows -static-libgcc -static-libstdc++ - CFLAGS += -DALURE_STATIC_LIBRARY - LIBS += -Lwin32/lib -lALURE32-static -lOpenAL32 + LIBS += -Lwin32/lib -lALURE32 -lOpenAL32 + SRC += scan-windows.c else OS := $(shell uname) ifeq ($(OS), Darwin) BIN := $(NAME) PKG_CONFIG_PATH := "./mac/lib/pkgconfig" - LDFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs alure openal) + LIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs alure openal) CFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags alure openal) - LDFLAGS += -framework ApplicationServices -framework OpenAL + LDFLAGS += -framework ApplicationServices -framework OpenAL + SRC += scan-mac.c else BIN := $(NAME) - LDFLAGS += $(shell pkg-config --libs openal alure xtst x11) - CFLAGS += $(shell pkg-config --cflags openal alure xtst x11) + ifdef libinput + LIBS += $(shell pkg-config --libs openal alure libinput libudev) + CFLAGS += $(shell pkg-config --cflags openal alure libinput libudev) + SRC += scan-libinput.c + else + LIBS += $(shell pkg-config --libs openal alure xtst x11) + CFLAGS += $(shell pkg-config --cflags openal alure xtst x11) + SRC += scan-x11.c + endif endif endif OBJS = $(subst .c,.o, $(SRC)) -CC = $(CROSS)gcc -LD = $(CROSS)gcc +CC ?= $(CROSS)gcc +LD ?= $(CROSS)gcc +CCLD ?= $(CC) STRIP = $(CROSS)strip %.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(BIN): $(OBJS) - $(LD) -o $@ $(OBJS) $(LIBS) $(LDFLAGS) + $(CCLD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) dist: mkdir -p $(NAME)-$(VERSION) @@ -55,7 +63,7 @@ gcc -Wall -Werror rec.c -o rec clean: - rm -f $(OBJS) $(BIN) core rec + $(RM) $(OBJS) $(BIN) core rec strip: $(BIN) $(STRIP) $(BIN) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/README.md new/bucklespring-1.5.0/README.md --- old/bucklespring-1.4.0/README.md 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/README.md 2021-01-21 12:54:15.000000000 +0100 @@ -7,7 +7,8 @@ bucklespring keyboard while typing on my notebook, mainly for the purpose of annoying the hell out of my coworkers. - + + Bucklespring runs as a background process and plays back the sound of each key pressed and released on your keyboard, just as if you were using an IBM @@ -23,16 +24,60 @@ Installation ------------ -### Linux +### Debian + +Bucklespring is available in the latest Debian and Ubuntu dev-releases, so you can +install with + +``` +$ sudo apt-get install bucklespring +``` + +### Linux, building from source To compile on debian-based linux distributions, first make sure the require libraries and header files are installed, then simply run `make`: -```` +#### Dependencies on Debian +``` $ sudo apt-get install libopenal-dev libalure-dev libxtst-dev +``` + +#### Dependencies on Arch Linux +``` +$ sudo pacman -S openal alure libxtst +``` + +#### Dependencies on Fedora Linux +``` +$ sudo dnf install gcc openal-soft-devel alure-devel libX11-devel libXtst-devel +``` + +#### Building +``` $ make $ ./buckle -```` +``` + +The default Linux build requires X11 for grabbing events. If you want to use +Bucklespring on the linux console or Wayland display server, you can configure +buckle to read events from the raw input devices in /dev/input. This will +require special permissions for buckle to open the devices, though. Build with + +``` +$ make libinput=1 +``` + +#### Using snap on Ubuntu (since 16.04) and other distros + +``` +$ sudo snap install bucklespring +$ bucklespring.buckle +``` + +The snap includes the OpenAL configuration tweaks mentioned in this README. +See http://snapcraft.io/ for more info about Snap packages + ### MacOS @@ -41,17 +86,24 @@ ``` $ brew install alure pkg-config +$ git clone https://github.com/zevv/bucklespring.git && cd bucklespring +$ sed -i '' 's/-Wall -Werror/-Wall/' Makefile $ make -$ sudo ./buckle +$ ./buckle ``` Note that you need superuser privileges to create the event tap on Mac OS X. +Also give your terminal Accessibility rights: system preferences -> security -> privacy -> accessibility +If you want to use buckle while doing normal work, add an & behind the command. +``` +$ sudo ./buckle & +``` ### Windows I think the windows build is currently broken, it seems that switching from -Freelut to Alure broke windows, I might fix this one day. +Freelut to Alure broke windows, I might fix this one day. I suspect there is something wrong with `alureCreateBufferFromFile()` getting called from another thread in the key capture callback, but my knowledge of the @@ -68,10 +120,12 @@ options: -d DEVICE use OpenAL audio device DEVICE + -f use a fallback sound for unknown keys -g GAIN set playback gain [0..100] + -m CODE use CODE as mute key (default 0x46 for scroll lock) + -M start the program muted -h show help -l list available openAL audio devices - -m CODE use CODE as mute key (default 0x46 for scroll lock) -p PATH load .wav files from directory PATH -s WIDTH set stereo width [0..100] -v increase verbosity / debugging @@ -85,7 +139,7 @@ realistic 3D audio playback. This section contains some tips and tricks for properly tuning OpenAL for bucklespring. -* The default OpenAL settings can cause a slight delay in playback. Edit or create +* The default OpenAL settings can cause a slight delay in playback. Edit or create the OpenAL configuration file `~/.alsoftrc` and add the following options: ```` @@ -93,18 +147,18 @@ periods = 4 ```` -* If you are using headphones, enabling the head-related-transfer functions in OpenAL +* If you are using headphones, enabling the head-related-transfer functions in OpenAL for a better 3D sound: ```` hrtf = true ```` - -* When starting an OpenAL application, the internal sound card is selected for output, - and you might not be able to change the device using pavucontrol. The option to select - an alternate device is present, but choosing the device has no effect. To solve this, + +* When starting an OpenAL application, the internal sound card is selected for output, + and you might not be able to change the device using pavucontrol. The option to select + an alternate device is present, but choosing the device has no effect. To solve this, add the following option to the OpenAL configuration file: - + ```` allow-moves = true ```` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/buckle.desktop new/bucklespring-1.5.0/buckle.desktop --- old/bucklespring-1.4.0/buckle.desktop 1970-01-01 01:00:00.000000000 +0100 +++ new/bucklespring-1.5.0/buckle.desktop 2021-01-21 12:54:15.000000000 +0100 @@ -0,0 +1,11 @@ +[Desktop Entry] + +Type=Application +Name=Buckle +Comment=Bucklespring keyboard sound +Exec=buckle -f +Icon=input-keyboard +StartupNotify=false +Terminal=false +Hidden=false + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/buckle.h new/bucklespring-1.5.0/buckle.h --- old/bucklespring-1.4.0/buckle.h 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/buckle.h 2021-01-21 12:54:15.000000000 +0100 @@ -2,7 +2,7 @@ #define buckle_h int play(int code, int press); -int scan(void); +int scan(int verbose); void printd(const char *fmt, ...); void open_console(void); Binary files old/bucklespring-1.4.0/img/buckle.gif and new/bucklespring-1.5.0/img/buckle.gif differ Binary files old/bucklespring-1.4.0/img/model-m.jpg and new/bucklespring-1.5.0/img/model-m.jpg differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/main.c new/bucklespring-1.5.0/main.c --- old/bucklespring-1.4.0/main.c 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/main.c 2021-01-21 12:54:15.000000000 +0100 @@ -8,9 +8,9 @@ #include <unistd.h> #include <limits.h> #include <stdbool.h> +#include <getopt.h> #include <time.h> - #ifdef __APPLE__ #include <OpenAL/al.h> #include <OpenAL/alure.h> @@ -43,16 +43,28 @@ */ static int keyloc[][32] = { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x66, 0x68, 0x1c, -1 }, - { 0x01, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0x6f, 0x6b, 0x6d, -1 }, - { 0x29, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, -1 }, - { 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x2b,-1 }, - { 0x3a, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x1c, -1 }, - { 0x2a, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, -1 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x66, 0x68, 0x1c, 0x45, 0x62, 0x37, 0x4a, -1 }, + { 0x01, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0x6f, 0x6b, 0x6d, 0x47, 0x48, 0x49, 0x4e, -1 }, + { 0x29, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x4b, 0x4c, 0x4d, -1 }, + { 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x2b, 0x4f, 0x50, 0x51, 0x60, -1 }, + { 0x3a, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x1c, 0x52, 0x53, -1 }, + { 0x2a, 0x56, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, -1 }, { 0x1d, 0x7d, 0x5b, 0x38, 0x39, 0x64, 0x61, 0x67, -1 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x6c, 0x6a, -1 }, }; +/* + * Horizontal position on keyboard of the pragmatic center of the row, since keys come in different sizes and shapes + */ +static double midloc[] = { + 7.5, + 7.5, + 7.5, + 6.5, + 6.5, + 6.5, + 4.5, +}; static int opt_verbose = 0; static int opt_stereo_width = 50; @@ -64,12 +76,32 @@ static int muted = 0; +static const char short_opts[] = "d:fg:hlm:Mp:s:v"; + +static const struct option long_opts[] = { + { "device", required_argument, NULL, 'd' }, + { "fallback-sound", no_argument, NULL, 'f' }, + { "gain", required_argument, NULL, 'g' }, + { "help", no_argument, NULL, 'h' }, + { "list-devices", no_argument, NULL, 'l' }, + { "mute-keycode", required_argument, NULL, 'm' }, + { "mute", no_argument, NULL, 'M' }, + { "audio-path", required_argument, NULL, 'p' }, + { "stereo-width", required_argument, NULL, 'w' }, + { "verbose", no_argument, NULL, 'v' }, + { 0, 0, 0, 0 } +}; + + + int main(int argc, char **argv) { int c; int rv = EXIT_SUCCESS; + int idx; - while( (c = getopt(argc, argv, "fhm:vd:g:lp:s:")) != EOF) { + while( (c = getopt_long(argc, argv, + short_opts, long_opts, &idx)) != -1) { switch(c) { case 'd': opt_device = optarg; @@ -89,8 +121,8 @@ case 'm': opt_mute_keycode = strtol(optarg, NULL, 0); break; - case 'v': - opt_verbose++; + case 'M': + muted = !muted; break; case 'p': opt_path_audio = optarg; @@ -98,6 +130,9 @@ case 's': opt_stereo_width = atoi(optarg); break; + case 'v': + opt_verbose++; + break; default: usage(argv[0]); return 1; @@ -135,12 +170,22 @@ return -1; } TEST_ERROR("make default context"); - + alListener3f(AL_POSITION, 0, 0, 0); alListener3f(AL_VELOCITY, 0, 0, 0); alListenerfv(AL_ORIENTATION, listenerOri); - scan(); + /* Path to data files can also be specified by environment, this is + * used by the snap package */ + + const char *env_path = getenv("BUCKLESPRING_WAV_DIR"); + if (env_path) { + opt_path_audio = env_path; + } + + printd("Using wav dir: \"%s\"\n", opt_path_audio); + + scan(opt_verbose); out: device = alcGetContextsDevice(context); @@ -160,15 +205,16 @@ "\n" "options:\n" "\n" - " -d DEVICE use OpenAL audio device DEVICE\n" - " -f use a fallback sound for unknown keys\n" - " -g GAIN set playback gain [0..100]\n" - " -m CODE use CODE as mute key (default 0x46 for scroll lock)\n" - " -h show help\n" - " -l list available openAL audio devices\n" - " -p PATH load .wav files from directory PATH\n" - " -s WIDTH set stereo width [0..100]\n" - " -v increase verbosity / debugging\n", + " -d, --device=DEVICE use OpenAL audio device DEVICE\n" + " -f, --fallback-sound use a fallback sound for unknown keys\n" + " -g, --gain=GAIN set playback gain [0..100]\n" + " -m, --mute-keycode=CODE use CODE as mute key (default 0x46 for scroll lock)\n" + " -M, --mute start the program muted\n" + " -h, --help show help\n" + " -l, --list-devices list available openAL audio devices\n" + " -p, --audi-path=PATH load .wav files from directory PATH\n" + " -s, --stereo-width=WIDTH set stereo width [0..100]\n" + " -v, --verbose increase verbosity / debugging\n", exe ); } @@ -222,7 +268,7 @@ if(keyloc[row][col] == -1) break; } if(keycol) { - return -1 + 2.0 * (double) (keycol-1) / (col-1); + return ((double) keycol-midloc[row])/(col-midloc[row]); } } return 0; @@ -307,7 +353,9 @@ TEST_ERROR("source generation"); double x = find_key_loc(code); - alSource3f(src[idx], AL_POSITION, -x, 0, (100 - opt_stereo_width) / 100.0); + if (opt_stereo_width > 0) { + alSource3f(src[idx], AL_POSITION, -x, 0, (100 - opt_stereo_width) / 100.0); + } alSourcef(src[idx], AL_GAIN, opt_gain / 100.0); alSourcei(src[idx], AL_BUFFER, buf[idx]); Binary files old/bucklespring-1.4.0/model-m.jpg and new/bucklespring-1.5.0/model-m.jpg differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/scan-libinput.c new/bucklespring-1.5.0/scan-libinput.c --- old/bucklespring-1.4.0/scan-libinput.c 1970-01-01 01:00:00.000000000 +0100 +++ new/bucklespring-1.5.0/scan-libinput.c 2021-01-21 12:54:15.000000000 +0100 @@ -0,0 +1,120 @@ +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/poll.h> +#include <string.h> +#include <errno.h> + +#include <libinput.h> + +#include "buckle.h" + + +static int open_restricted(const char *path, int flags, void *user_data) +{ + int fd = open(path, flags); + + if(fd < 0) { + fprintf(stderr, "Failed to open %s (%s)\n", path, strerror(errno)); + } + + return fd < 0 ? -errno : fd; +} + + +static void close_restricted(int fd, void *user_data) +{ + close(fd); +} + + +static const struct libinput_interface interface = { + .open_restricted = open_restricted, + .close_restricted = close_restricted, +}; + + +static void handle_key(struct libinput_event *ev) +{ + struct libinput_event_keyboard *k = libinput_event_get_keyboard_event(ev); + enum libinput_key_state state = libinput_event_keyboard_get_key_state(k); + uint32_t key = libinput_event_keyboard_get_key(k); + + play(key, state == LIBINPUT_KEY_STATE_PRESSED); +} + +static void handle_events(struct libinput *li) +{ + struct libinput_event *ev; + + libinput_dispatch(li); + + while((ev = libinput_get_event(li))) { + + switch(libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_KEYBOARD_KEY: + handle_key(ev); + break; + default: + break; + } + + libinput_event_destroy(ev); + libinput_dispatch(li); + } +} + + +static void log_handler(struct libinput *li, enum libinput_log_priority priority, + const char *format, va_list args) +{ + vprintf(format, args); +} + + +int scan(int verbose) +{ + struct udev *udev; + struct libinput *li; + + udev = udev_new(); + if (!udev) { + fprintf(stderr, "Failed to initialize udev\n"); + return -1; + } + + li = libinput_udev_create_context(&interface, NULL, udev); + if(!li) { + fprintf(stderr, "Failed to initialize context\n"); + return -1; + } + + if(verbose) { + libinput_log_set_handler(li, log_handler); + libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG); + } + + if (libinput_udev_assign_seat(li, "seat0")) { + fprintf(stderr, "Failed to set seat\n"); + return -1; + } + + libinput_dispatch(li); + + struct pollfd fds; + fds.fd = libinput_get_fd(li); + fds.events = POLLIN; + fds.revents = 0; + + while(poll(&fds, 1, -1) > -1) { + handle_events(li); + } + + return 0; +} + + +void open_console(void) +{ +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/scan-linux.c new/bucklespring-1.5.0/scan-linux.c --- old/bucklespring-1.4.0/scan-linux.c 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/scan-linux.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,96 +0,0 @@ - -#ifdef linux - -#include <stdio.h> - -#include <X11/XKBlib.h> -#include <X11/extensions/record.h> - -#include "buckle.h" - -void key_pressed_cb(XPointer arg, XRecordInterceptData *d); - -int scan(void) -{ - /* Initialize and start Xrecord context */ - - XRecordRange* rr; - XRecordClientSpec rcs; - XRecordContext rc; - - printd("Opening Xrecord context"); - - Display *dpy = XOpenDisplay(NULL); - if(dpy == NULL) { - fprintf(stderr, "Unable to open display\n"); - return -1; - } - - rr = XRecordAllocRange (); - if(rr == NULL) { - fprintf(stderr, "XRecordAllocRange error\n"); - return -1; - } - - rr->device_events.first = KeyPress; - rr->device_events.last = KeyRelease; - rcs = XRecordAllClients; - - rc = XRecordCreateContext (dpy, 0, &rcs, 1, &rr, 1); - if(rc == 0) { - fprintf(stderr, "XRecordCreateContext error\n"); - return -1; - } - - XFree (rr); - - if(XRecordEnableContext(dpy, rc, key_pressed_cb, NULL) == 0) { - fprintf(stderr, "XRecordEnableContext error\n"); - return -1; - } - - /* We never get here */ - - return 0; -} - - -/* - * Xrecord event callback - */ - -void key_pressed_cb(XPointer arg, XRecordInterceptData *d) -{ - if (d->category != XRecordFromServer) - return; - - int key = ((unsigned char*) d->data)[1]; - int type = ((unsigned char*) d->data)[0] & 0x7F; - int repeat = d->data[2] & 1; - - key -= 8; /* X code to scan code? */ - - if(!repeat) { - - switch (type) { - case KeyPress: - play(key, 1); - break; - case KeyRelease: - play(key, 0); - break; - default: - break; - } - } - - XRecordFreeData (d); -} - - -void open_console(void) -{ -} - -#endif - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/scan-mac.c new/bucklespring-1.5.0/scan-mac.c --- old/bucklespring-1.4.0/scan-mac.c 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/scan-mac.c 2021-01-21 12:54:15.000000000 +0100 @@ -1,6 +1,3 @@ - -#ifdef __APPLE__ - #include <ApplicationServices/ApplicationServices.h> #include "buckle.h" @@ -180,7 +177,7 @@ } -int scan(void) +int scan(int verbose) { CFMachPortRef eventTap; CGEventMask eventMask; @@ -214,6 +211,3 @@ void open_console(void) { } - -#endif - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/scan-windows.c new/bucklespring-1.5.0/scan-windows.c --- old/bucklespring-1.4.0/scan-windows.c 2016-10-04 15:52:29.000000000 +0200 +++ new/bucklespring-1.5.0/scan-windows.c 2021-01-21 12:54:15.000000000 +0100 @@ -1,6 +1,3 @@ - -#ifdef WIN32 - #include <windows.h> #include <winuser.h> #include <stdio.h> @@ -17,9 +14,9 @@ static int state[256] = { 0 }; -int scan(void) +int scan(int verbose) { - HINSTANCE hInst; + HINSTANCE hInst = GetModuleHandle(NULL); kbh = SetWindowsHookEx(WH_KEYBOARD_LL, handle_kbh, hInst, 0); @@ -58,7 +55,7 @@ void open_console() { int hConHandle; - long lStdHandle; + INT_PTR lStdHandle; CONSOLE_SCREEN_BUFFER_INFO coninfo; FILE *fp; @@ -69,7 +66,7 @@ coninfo.dwSize.Y = 500; SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize); - lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE); + lStdHandle = (INT_PTR)GetStdHandle(STD_OUTPUT_HANDLE); hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); fp = _fdopen( hConHandle, "w" ); @@ -77,7 +74,3 @@ *stderr = *fp; setvbuf(fp, NULL, _IONBF, 0 ); } - - -#endif - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bucklespring-1.4.0/scan-x11.c new/bucklespring-1.5.0/scan-x11.c --- old/bucklespring-1.4.0/scan-x11.c 1970-01-01 01:00:00.000000000 +0100 +++ new/bucklespring-1.5.0/scan-x11.c 2021-01-21 12:54:15.000000000 +0100 @@ -0,0 +1,98 @@ +#include <stdio.h> + +#include <X11/XKBlib.h> +#include <X11/extensions/record.h> + +#include "buckle.h" + +void key_pressed_cb(XPointer arg, XRecordInterceptData *d); + +int scan(int verbose) +{ + /* Initialize and start Xrecord context */ + + XRecordRange* rr; + XRecordClientSpec rcs; + XRecordContext rc; + + printd("Opening Xrecord context"); + + Display *dpy = XOpenDisplay(NULL); + if(dpy == NULL) { + fprintf(stderr, "Unable to open display\n"); + return -1; + } + + rr = XRecordAllocRange (); + if(rr == NULL) { + fprintf(stderr, "XRecordAllocRange error\n"); + return -1; + } + + rr->device_events.first = KeyPress; + rr->device_events.last = ButtonReleaseMask; + rcs = XRecordAllClients; + + rc = XRecordCreateContext (dpy, 0, &rcs, 1, &rr, 1); + if(rc == 0) { + fprintf(stderr, "XRecordCreateContext error\n"); + return -1; + } + + XFree (rr); + + if(XRecordEnableContext(dpy, rc, key_pressed_cb, NULL) == 0) { + fprintf(stderr, "XRecordEnableContext error\n"); + return -1; + } + + /* We never get here */ + + return 0; +} + + +/* + * Xrecord event callback + */ + +void key_pressed_cb(XPointer arg, XRecordInterceptData *d) +{ + if (d->category != XRecordFromServer) + return; + + int key = ((unsigned char*) d->data)[1]; + int type = ((unsigned char*) d->data)[0] & 0x7F; + int repeat = d->data[2] & 1; + + key -= 8; /* X code to scan code? */ + + if(!repeat) { + + switch (type) { + case KeyPress: + play(key, 1); + break; + case KeyRelease: + play(key, 0); + break; + case ButtonPress: + if(key == -5 || key == -7) + play(0xff, 1); + break; + case ButtonRelease: + if(key == -5 || key == -7) + play(0xff, 0); + break; + default: + break; + } + } + + XRecordFreeData (d); +} + + +void open_console(void) +{ +} Binary files old/bucklespring-1.4.0/wav/02-1.wav and new/bucklespring-1.5.0/wav/02-1.wav differ Binary files old/bucklespring-1.4.0/wav/05-0.wav and new/bucklespring-1.5.0/wav/05-0.wav differ Binary files old/bucklespring-1.4.0/wav/37-0.wav and new/bucklespring-1.5.0/wav/37-0.wav differ Binary files old/bucklespring-1.4.0/wav/37-1.wav and new/bucklespring-1.5.0/wav/37-1.wav differ Binary files old/bucklespring-1.4.0/wav/45-0.wav and new/bucklespring-1.5.0/wav/45-0.wav differ Binary files old/bucklespring-1.4.0/wav/45-1.wav and new/bucklespring-1.5.0/wav/45-1.wav differ Binary files old/bucklespring-1.4.0/wav/47-0.wav and new/bucklespring-1.5.0/wav/47-0.wav differ Binary files old/bucklespring-1.4.0/wav/47-1.wav and new/bucklespring-1.5.0/wav/47-1.wav differ Binary files old/bucklespring-1.4.0/wav/48-0.wav and new/bucklespring-1.5.0/wav/48-0.wav differ Binary files old/bucklespring-1.4.0/wav/48-1.wav and new/bucklespring-1.5.0/wav/48-1.wav differ Binary files old/bucklespring-1.4.0/wav/49-0.wav and new/bucklespring-1.5.0/wav/49-0.wav differ Binary files old/bucklespring-1.4.0/wav/49-1.wav and new/bucklespring-1.5.0/wav/49-1.wav differ Binary files old/bucklespring-1.4.0/wav/4a-0.wav and new/bucklespring-1.5.0/wav/4a-0.wav differ Binary files old/bucklespring-1.4.0/wav/4a-1.wav and new/bucklespring-1.5.0/wav/4a-1.wav differ Binary files old/bucklespring-1.4.0/wav/4b-0.wav and new/bucklespring-1.5.0/wav/4b-0.wav differ Binary files old/bucklespring-1.4.0/wav/4b-1.wav and new/bucklespring-1.5.0/wav/4b-1.wav differ Binary files old/bucklespring-1.4.0/wav/4c-0.wav and new/bucklespring-1.5.0/wav/4c-0.wav differ Binary files old/bucklespring-1.4.0/wav/4c-1.wav and new/bucklespring-1.5.0/wav/4c-1.wav differ Binary files old/bucklespring-1.4.0/wav/4d-0.wav and new/bucklespring-1.5.0/wav/4d-0.wav differ Binary files old/bucklespring-1.4.0/wav/4d-1.wav and new/bucklespring-1.5.0/wav/4d-1.wav differ Binary files old/bucklespring-1.4.0/wav/4e-0.wav and new/bucklespring-1.5.0/wav/4e-0.wav differ Binary files old/bucklespring-1.4.0/wav/4e-1.wav and new/bucklespring-1.5.0/wav/4e-1.wav differ Binary files old/bucklespring-1.4.0/wav/4f-0.wav and new/bucklespring-1.5.0/wav/4f-0.wav differ Binary files old/bucklespring-1.4.0/wav/4f-1.wav and new/bucklespring-1.5.0/wav/4f-1.wav differ Binary files old/bucklespring-1.4.0/wav/50-0.wav and new/bucklespring-1.5.0/wav/50-0.wav differ Binary files old/bucklespring-1.4.0/wav/50-1.wav and new/bucklespring-1.5.0/wav/50-1.wav differ Binary files old/bucklespring-1.4.0/wav/51-0.wav and new/bucklespring-1.5.0/wav/51-0.wav differ Binary files old/bucklespring-1.4.0/wav/51-1.wav and new/bucklespring-1.5.0/wav/51-1.wav differ Binary files old/bucklespring-1.4.0/wav/52-0.wav and new/bucklespring-1.5.0/wav/52-0.wav differ Binary files old/bucklespring-1.4.0/wav/52-1.wav and new/bucklespring-1.5.0/wav/52-1.wav differ Binary files old/bucklespring-1.4.0/wav/53-0.wav and new/bucklespring-1.5.0/wav/53-0.wav differ Binary files old/bucklespring-1.4.0/wav/53-1.wav and new/bucklespring-1.5.0/wav/53-1.wav differ Binary files old/bucklespring-1.4.0/wav/56-0.wav and new/bucklespring-1.5.0/wav/56-0.wav differ Binary files old/bucklespring-1.4.0/wav/56-1.wav and new/bucklespring-1.5.0/wav/56-1.wav differ Binary files old/bucklespring-1.4.0/wav/60-0.wav and new/bucklespring-1.5.0/wav/60-0.wav differ Binary files old/bucklespring-1.4.0/wav/60-1.wav and new/bucklespring-1.5.0/wav/60-1.wav differ Binary files old/bucklespring-1.4.0/wav/62-0.wav and new/bucklespring-1.5.0/wav/62-0.wav differ Binary files old/bucklespring-1.4.0/wav/62-1.wav and new/bucklespring-1.5.0/wav/62-1.wav differ Binary files old/bucklespring-1.4.0/wav/ff-0.wav and new/bucklespring-1.5.0/wav/ff-0.wav differ Binary files old/bucklespring-1.4.0/wav/ff-1.wav and new/bucklespring-1.5.0/wav/ff-1.wav differ