mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-07 07:31:53 -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 = "";
|
std::string boundOutput = "";
|
||||||
bool flipX = false; // decide to invert horizontal movement
|
bool flipX = false; // decide to invert horizontal movement
|
||||||
bool flipY = false; // decide to invert vertical movement
|
bool flipY = false; // decide to invert vertical movement
|
||||||
|
bool isTouchpad = false;
|
||||||
|
|
||||||
WP<IPointer> self;
|
WP<IPointer> self;
|
||||||
};
|
};
|
||||||
|
@@ -14,6 +14,11 @@ CMouse::CMouse(SP<Aquamarine::IPointer> mouse_) : mouse(mouse_) {
|
|||||||
if (!mouse)
|
if (!mouse)
|
||||||
return;
|
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) {
|
listeners.destroy = mouse->events.destroy.registerListener([this](std::any d) {
|
||||||
mouse.reset();
|
mouse.reset();
|
||||||
events.destroy.emit();
|
events.destroy.emit();
|
||||||
|
@@ -93,14 +93,16 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
|
|||||||
Vector2D delta = e.delta;
|
Vector2D delta = e.delta;
|
||||||
Vector2D unaccel = e.unaccel;
|
Vector2D unaccel = e.unaccel;
|
||||||
|
|
||||||
if (!e.mouse && e.device) {
|
if (e.device) {
|
||||||
if (e.device->flipX) {
|
if (e.device->isTouchpad) {
|
||||||
delta.x = -delta.x;
|
if (e.device->flipX) {
|
||||||
unaccel.x = -unaccel.x;
|
delta.x = -delta.x;
|
||||||
}
|
unaccel.x = -unaccel.x;
|
||||||
if (e.device->flipY) {
|
}
|
||||||
delta.y = -delta.y;
|
if (e.device->flipY) {
|
||||||
unaccel.y = -unaccel.y;
|
delta.y = -delta.y;
|
||||||
|
unaccel.y = -unaccel.y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user