From bd64113ab5cc1eff372dfd8f096a1ab754e0c96b Mon Sep 17 00:00:00 2001 From: johannes hanika Date: Sat, 16 Nov 2024 18:24:00 +0100 Subject: [PATCH] pointer constraints: don't warp pointer position on release this was annoying for nuklear properties/ui slider elements that grab the pointer via GLFW_CURSOR_DISABLE to allow more range and finer control. upon mouse release, the pointer is reset to the middle of the window without this patch, making long mouse movements necessary to go back to the original position for readjustments. fwiw the new behaviour is consistent with x11 and weston. --- src/protocols/PointerConstraints.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp index 0f2dd991144..7f08a7df9e1 100644 --- a/src/protocols/PointerConstraints.cpp +++ b/src/protocols/PointerConstraints.cpp @@ -188,7 +188,7 @@ Vector2D CPointerConstraint::logicPositionHint() { const auto SURFBOX = pHLSurface->getSurfaceBoxGlobal(); const auto CONSTRAINTPOS = SURFBOX.has_value() ? SURFBOX->pos() : Vector2D{}; - return hintSet ? CONSTRAINTPOS + positionHint : (locked ? CONSTRAINTPOS + SURFBOX->size() / 2.f : cursorPosOnActivate); + return hintSet ? CONSTRAINTPOS + positionHint : cursorPosOnActivate; } CPointerConstraintsProtocol::CPointerConstraintsProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {