Skip to content

Commit

Permalink
pointer constraints: don't warp pointer position on release
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hanatos committed Nov 16, 2024
1 parent 83be248 commit bd64113
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/protocols/PointerConstraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit bd64113

Please sign in to comment.