mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 07:01:57 -07:00
input: fixup mouse check for flipping x / y (#9529)
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
@@ -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();
|
||||
|
@@ -93,7 +93,8 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
|
||||
Vector2D delta = e.delta;
|
||||
Vector2D unaccel = e.unaccel;
|
||||
|
||||
if (!e.mouse && e.device) {
|
||||
if (e.device) {
|
||||
if (e.device->isTouchpad) {
|
||||
if (e.device->flipX) {
|
||||
delta.x = -delta.x;
|
||||
unaccel.x = -unaccel.x;
|
||||
@@ -103,6 +104,7 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
|
||||
unaccel.y = -unaccel.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto DELTA = *PNOACCEL == 1 ? unaccel : delta;
|
||||
|
||||
|
Reference in New Issue
Block a user