This ensures that it is fired in all instances where the property is
updated, and not just on our own `set_active` method.
We also cache the property so that we can emit the signals only for the
profile that *was* the active one, and the one that *became* the active
one, to circumvent
bb23f68d53/ratbagd/ratbagd-profile.c (L271)Fixes#167.
In a previous commit I added this optimization that prevents redrawing
the widget when it is reallocated: with the widget being centered,
enlarging the window does not require to redraw the widget.
However, I missed the case where the allocation actually gets smaller
(and thus the SVG is repositioned) when the width of one of the child
widgets changes, which would with this optimization result in parts of
the SVG being shifted a few pixels to the left with the remainder being
in its original position. Hence, this fixes a visual glitch in drawing
the SVG.
If ratbag is None, we crash during add_perspective because the other
perspectives rely on it being valid. Instead of adding a bunch of "is None" to
the add_perspective call, just add the ErrorPerspective first, check for
ratbag and exit if it doesn't exist. Otherwise, add the other two
perspectives and continue on our merry way.
The event state may never be 0 if e.g. numlock is turned on. And it shouldn't
matter for us anyway, let's not go to the headache of trying to figure out how
to map return/escape.
This change cleans up the shady KeyStroke class that never felt quite
right. Its behavior is split over RatbagdMacro, which is a new class
abstracting a macro as a list of (type, keycode) tuples with a
human-readable representation and methods to manipulate said list, and
the existing ButtonDialog class which is now again fully responsible for
any and all input event handling. RatbagdMacro has no notion whatsoever
of Gdk; all of this is now only found in Piper's GUI code where it
belongs.
The ratbagd test device still uses a Key action type which we ignore in piper.
This leads to the correct "Unknown" display, but crashes when we click on the
button to configure it - self._mapping triggers and AttributeError.
Avoid this by simply resetting it to -1. At least that way we don't crash.
If the button is configured as anything other than left-handed, select
right-handed layout. We only support left/right-handed assignment in piper, so
don't fall through the cracks where the mouse has been preconfigured as
something else