The BindingProfile class had a bunch of untested code that was assigning to
things by the wrong name, or making logic errors all throughout. With the added
unit tests, that cleans it up considerably.
This reduces some of the notifications during changes by reducing the scope of
changes that are monitored by other components in the system. IOW, this allows
keys to only care about their particular changes, rather than all key binding
changes in a BindingProfile.
This gets us nearly to a proper profile manager and keybinding tool! Very very
close, despite the messiness of the codebase. There's lots of low hanging fruit
for those who are interested in contributing.
- Made BindingProfile serializable to a python dict
- Fixed a bug in BindingProfile that named keys in the g13d command stream
incorrectly.
- Made ButtonMenu attempt to grab the keyboard when it shows so we can get
more correct keypresses. This is only half the battle -- need to stop GTK's
event loop for other widgets from catching events and handling them.
- Added a g13d communications worker thread, including saving of profiles to
disk as well as uploading profile configurations to g13d. This uses a Queue
for incoming tasks from the GUI thread, and dispatches results back by way
of GObject signals. Could use some work to make this less clunky.
- Made MainWindow load the profiles from disk. This is done on the GUI thread,
which isn't ideal.
- Added an Upload button to push changes over to g13d. This reacts to the
worker thread's connected/disconnected signals.
This represents a full day of work just to get the binding behaviors correct and
the profile behaviors correct. At this point, this should be possible to turn
into something useful for controlling g13d with.
Things left to do:
- Setup a thread for communicating with g13d with
- Setup a worker queue to send profile changes or updates to the g13d daemon
Once those are in there, we can consider this to be feature complete for 1.0.
Additional functionality, such as LED colors, drawing to the LCD, and things
like supporting dbus IPC so we can handle applets on the LCD will come later.
Late night hacking causes all kinds of silliness. We only want to stop running
an action when the key is not pressed now, but was prior pressed. My logic
caused it to fire when not pressed and not prior pressed, erroneously, leading
to stuck keys.
Totally misread the code in the Action_keys::act method -- the code actually
reverse sends events in an up condition. Still, keeping the C++11 iteration and
improving by using boost::adaptors::reverse.
Double underbars are reserved for the compiler and system, so we shouldn't use
them for header guards. Additionally, remove a bunch of these line breaks.
Lots of cross-translation unit messes in here cleaned up finally. This should be
the last change necessary to clean up these refs between translation units.
This is the first half of some major rework of the g13d codebase to make things
a bit more manageable. This splits out a great deal of stuff from helper.h into
separate translation units, and also breaks out a great deal of the g13.h header
into separate translation units as well.
Doing this saves in compilation time as we make changes to the system, and also
helps to clean up a whole bunch of leaking symbols.
Since we start from udev/systemd these days, we should exit when we don't have
any more devices to manage, and let udev/systemd manage things when a new one is
connected.
Migrate to C++11 iteration and clean up the mess of code that this was
originally with a single call to send_event and a proper use of a ternary for
logging.
The sizeof was actually using the size of the statically allocated name instead
of the size of the destination. In practice, it's not a problem, but still, it
should be fixed.
The original code was just throwing away error conditions for write calls to an
fd. Obviously this is bad, but really, we should probably be using an ostream
instead of a raw file handle here. For now, deal with the warning by checking
the result for errors, at least, and later we'll refactor to use ostream
properly.
This starts to make g13d more automatic. Instead of requiring manual
intervention or automatic starts on system start, this will allow udevd to
automatically trigger g13d when a g13 is plugged in.
There's still a bug in g13d where if the device falls off the USB chain g13d
won't exit, though, but this is a good start.