libinput/connection: Ensure touchpad defaults are used

The previous logic would set `defaults` to the last found group.

Since a touchpad is a pointer, it would set `defaults` to point
to `[Libinput][Defaults][Pointer]`, and thus the next clause would
try to find `[Libinput][Defaults][Pointer][Touchpad]`, instead of the
expected `[Libinput][Defaults][Touchpad]`. That is, only if a default
was set for Pointer.

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
This commit is contained in:
Samuel Dionne-Riel 2022-11-26 00:28:54 -05:00 committed by Vlad Zahorodnii
parent 5cab7c79b4
commit 81ff7e6316

View file

@ -647,12 +647,11 @@ void Connection::applyDeviceConfig(Device *device)
if (defaults.isValid()) {
if (device->isAlphaNumericKeyboard() && defaults.hasGroup("Keyboard")) {
defaults = defaults.group("Keyboard");
}
if (device->isPointer() && defaults.hasGroup("Pointer")) {
defaults = defaults.group("Pointer");
}
if (device->isTouchpad() && defaults.hasGroup("Touchpad")) {
} else if (device->isTouchpad() && defaults.hasGroup("Touchpad")) {
// A Touchpad is a Pointer, so we need to check for it before Pointer.
defaults = defaults.group("Touchpad");
} else if (device->isPointer() && defaults.hasGroup("Pointer")) {
defaults = defaults.group("Pointer");
}
device->setDefaultConfig(defaults);