forge
Explore
Log in

Don't you dare go Hollow

Only warp pointer in remove_constraint() if it's still on the surface

Browse files at this commit

9474d05e79019f7fc3d43b112beb18e6987d1900Ivan MolodetskikhParent: 464d45d
src/handlers/mod.rsmodified+10 -0
@@ -217,6 +217,16 @@ impl PointerConstraintsHandler for State {
217 return;217 return;
218 };218 };
219 219
220+ // If the constraint was broken by the pointer forcibly leaving the surface (e.g. the user
221+ // opened the overview), then it doesn't make much sense to warp it.
222+ //
223+ // Furthermore, when the constraint is removed as part of the pointer leaving the surface,
224+ // this call happens with locked pointer data, and calling set_location() will try to lock
225+ // it again and deadlock.
226+ if pointer.last_enter().is_none() {
227+ return;
228+ }
229+
220 pointer.set_location(target);230 pointer.set_location(target);
221 231
222 // Redraw to update the cursor position if it's visible.232 // Redraw to update the cursor position if it's visible.