Only warp pointer in remove_constraint() if it's still on the surface
Browse files at this commit9474d05e79019f7fc3d43b112beb18e6987d1900Parent: 464d45d1 changed file +10 -0
- src/handlers/mod.rs +10 -0
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. |