I really like this series @PulkoMandy! I hope that more and more people share their dev stories here, it’s a good way to let our community know what we are working on (and how things are going).
In the past few weeks (months?) I’ve been busy with three projects (TL;DR):
- an input filter that enables scrolling on thinkpads (middle mouse button + trackpad up/down)
- a plugin for Claws Mail that provides some integration with Haiku
- Genio which usually is my main focus
Input filter
There is little to say here, this filter works but there are a few aspects that need to be ironed out and polished. It supports natural and reverse scrolling and both horizontal and vertical scrolling.
I’m not 100% with the way horizontal scrolling is implemented, the area tends to scroll in all directions and it’s quite annoying. Either I’m able to “predict” the direction and lock it or I need to dismiss this future.
Currently the filter intercepts the press of the middle button (and/or keyboard modifiers) and the trackpad gestures and translates this into a traditional mouse wheel scrolling message. This leads to a very fast scrolling allowing for little control on the trackpad. I need to figure out how to make it smoother and more precise.
This filter is not published yet but if you are interested to test it let me know!
Claws Mail plugin
I use iCloud mail and like all Apple products or services it has its own quirks when it’s used outside of the Apple ecosystem.
Mail daemon can receive but not send, Beam can send but is unable to receive. Other clients have problems, too.
Unfortunately mail daemon does not like iCloud or the opposite… Establishing an SSL connection is unreliable most of the times ending with a connection refused by the server (there’s a ticket about this)
The only one that works consistently and reliably with it is Claws. It has several problems and limitations, of course. As a non-native glib/gtk app it does not integrate at all with Haiku let alone other critical issues like the keymap and the inability to use the @ symbol. Nevertheless, it is what it is…
I started an effort to create a plugin for Claws which somehow works for me, see the details here.
The most annoying part was to deal with glib/gtk which I think nobody is interested in.
During the development I’ve instead come across a few interesting things.
A mixed C/C++ shared library apparently does not export all the symbols correctly so a Deskbar can’t be “embedded” into it. I had to create a separate application that is launched by the plugin upon loading and quit upon exit.
I have chosen this path also because the wrapping BApplication allows me to send messages to the application more easily.
The replicant lives in the Deskbar and there is no easy way to get its instance to send BMessages to.
One can either traverse the tree of all the views living inside the Deskbar (extremely annoying, complex and error prone) or let the BView subscribe (watch) specific messages hitting the BApplication:
if (LockLooper()) {
StartWatching(fAppMessenger, UPDATE_STATISTICS);
UnlockLooper();
}
It then receives the messages notified via SendNotices()
by the BApplication in MessageReceived():
case B_OBSERVER_NOTICE_CHANGE:
{
int32 code;
msg->FindInt32(B_OBSERVE_WHAT_CHANGE, &code);
switch (code) {
case UPDATE_STATISTICS:
{ ... }
Thanks to @jackburton for pointing me in this direction!
Another interesting thing I’ve consequently achieved is to inject some features in the Claws application under the form form of a Message filter coupled with a custom BHandler atteached to the main application. The idea came after using and customizing spybmessage.cpp which is available in the Haiku source code but is not built by default and shipped with a typical installation.
By hijacking the existing messaging system, I was able to receive messages that Claws was not designed to handle like B_ARGV_RECEIVED and B_REFS_RECEIVED along with custom ones from the Deskbar replicant like COMPOSE_MESSAGE.
Genio
I’m setting the foundation for an overhaul of the git subsystem. I’ve taken some code and inspiration from TrackGit but in the end this is going to a different path.
The first feature that found its way is Cloning a remote repository and opening it in the workspace (available in the main branch here).
At the core of this feature there is a new Task class which is a polimorfic perfect-forwarding template that accepts all kind of callables (free functions, lambdas, class methods, etc.), runs a thread and returns a BMessage to the BMessenger provided when the task is complete.
The BMessage includes a TaskResult instance serialized that holds the result if available and any exception eventually raised in the task that is transported to the TaskResult and is rethrown when calling GetResult().
If you want to know more about this, please have a look at how it is implemented in Genio here and here. There’s also a standalone repository with some tests built-in here.
Is it interesting? I don’t know but I hope someone enjoys it as much as I enjoyed writing it.