Some distros set this flag by default, so it
seems prudent to ensure we can compile with it
set. This should fix master compilation
issues on arch and fedora.
It turns out the linux uinput driver is capable of
automatically generating repeat events if you
flip the right kernel bit, so we can eliminate
the kludgy thread based repeat logic.
This should also fix#397, since said code was relying
on undefined pthread behaviour that caused some systems
to busy wait.
Simplify the modifier table and reuse config parsing logic to simplify
config initialization. This comes with a small performance
penalty when parsing configs (~50 us), but makes things much
tidier.
For the moment these are functionally equivalent the end-to-end python tests
(make test) without spinning up and exercising the daemon. Eventually they
should extend or complement them.
Mostly plumbing.
Summary:
- Key processing logic remains untouched.
- Simplified IPC logic.
- Streamlined the event loop.
- Consolidated config and descriptor parsing logic into config.[ch].
- Eliminated internal KEYD_* environment variables in favour of compile time macros.
- Added color coding to the daemon output.
- Load all configuration files on initialization.
The last change increases initialization time (on the order of μs) and resident
memory size, but simplifies the config logic and has the benefit of linting all
files immediately while also allowing for the introduction of in-daemon
reloading. This ultimately results in a net saving for the user since
most service managers are horrendously slow :(.
It also means hotplugged devices will use the in-memory config set (which
probably makes more sense anyway) instead of dynamically scanning the config
directory. This is more efficient for small config directories (<100 files),
but less efficient for large ones (uncommon).
- usleep was removed in POSIX.1-2008 (X/Open Issue 7)
- DT_DIR and flock are BSD extensions but BSDs don't use _DEFAULT_SOURCE
- _DEFAULT_SOURCE in GNU exposes POSIX.1-2008 + BSD + SysV mix
Tidy up the parsing logic and make everything valid c11
while we are at it :P.
The patch also eliminates the optional macro argument from swap(),
replacing it with a dedicated function (swap2()).
This breaks compatibility with a small number of configs,
but makes things more consistent.
The stock XCompose file which ships with most distros isn't exhaustive
and uses a number of layout specific keysyms intended to be easy to
memorize (rather than globally accessible). To circumvent this problem
we ship our own set of simplified compose definitions.
If we encounter a utf8 sequence corresponding to a glyph for which a
known XKB compose sequence exists, we replace the glyph with the
corresponding sequence. This allows non-english users to easilly specify
alternate glyphs without having to memorize the appropriate macros.
This is a major release which breaks backward compatibility for
non-trivial configs. (we are still in beta after all :P).
In the absence of too much blowback this will probably become the final
v2 design.
Much of this harkens back to the v1, with some additional simplifications
and enhancements.
See DESIGN.md for a more detailed account.
The end result should (hopefully) be a little more robust (and systemd independent).
I no longer remember what possessed me to switch away from the original
inotify implementation, but udev detection seems to have caused
enough grief to warrant switching back.
This will probably break FreeBSD support without some kind of
inotify glue and/or a kqueue implementation. If any FreeBSD
users see this feel free to open an issue or submit a PR :P.
keyd redux take 1.
A rewrite which simplifies the config format and provides a
solid foundation for incrementally introducing experimental
features.
Internally:
- Modularized and rewrote most of the code
- Added a mini testing framework (t/)
Externally:
- Eliminated layer inheritance in favour of simple types.
(layouts are now defined with `:layout` instead of `:main`)
- Macros are now repeatable.
- Overload now accepts a hold threshold timeout.
- Config files are now vendor/product id oriented.
- SIGUSR1 now triggers a config reload.
- Modifiers are layers by default and can be extended directly.
- Config files now end in `.conf`.
- `layert()` is now `toggle()`.
- All layers are 'modifier layers' (terminological change)
- Eliminated the dedicated modifer layout.
- Modifiers no longer apply to key sequences defined within a layer.
(Layer sequences are now always executed verbatim.)
The old behaviour was unintuitive and can be emulated using nested
layers if necessary.
If an interposed key up event is detected after an overloaded key is
pressed the overloaded key up event is not interpreted as a tap. This is
especially noticeable in cases where the overloaded key is struck
quickly in succession. This patch modifies the behaviour so only an
interposed key down resolves the overloaded key in favour of its
associated layer.