diff options
| author | nyx <nnyyxxxx@protonmail.com> | 2025-03-06 11:33:01 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-06 17:33:01 +0100 |
| commit | 4435f5c5463978ea689e6b4aa30e455e061a80ad (patch) | |
| tree | db6297b675d5c148f52e898980108ffdacf1b609 /src/devices | |
| parent | 7a84317f33e325155a6d7157db815b27fb26b75f (diff) | |
input: fixup mouse check for flipping x / y (#9529)
Diffstat (limited to 'src/devices')
| -rw-r--r-- | src/devices/IPointer.hpp | 1 | ||||
| -rw-r--r-- | src/devices/Mouse.cpp | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/devices/IPointer.hpp b/src/devices/IPointer.hpp index 19d91c6c..d5541222 100644 --- a/src/devices/IPointer.hpp +++ b/src/devices/IPointer.hpp @@ -112,6 +112,7 @@ class IPointer : public IHID { std::string boundOutput = ""; bool flipX = false; // decide to invert horizontal movement bool flipY = false; // decide to invert vertical movement + bool isTouchpad = false; WP<IPointer> self; }; diff --git a/src/devices/Mouse.cpp b/src/devices/Mouse.cpp index 87f6d33b..600ae5a8 100644 --- a/src/devices/Mouse.cpp +++ b/src/devices/Mouse.cpp @@ -14,6 +14,11 @@ CMouse::CMouse(SP<Aquamarine::IPointer> mouse_) : mouse(mouse_) { if (!mouse) return; + if (auto handle = mouse->getLibinputHandle()) { + double w = 0, h = 0; + isTouchpad = libinput_device_has_capability(handle, LIBINPUT_DEVICE_CAP_POINTER) && libinput_device_get_size(handle, &w, &h) == 0; + } + listeners.destroy = mouse->events.destroy.registerListener([this](std::any d) { mouse.reset(); events.destroy.emit(); |
