Fix #118694: snap cursor sometimes doesn't update when dragging and dropping assets #120475

Merged
Germano Cavalcante merged 5 commits from mano-wii/blender:fix_118694 into main 2024-04-12 15:27:16 +02:00

5 Commits

Author SHA1 Message Date
Germano Cavalcante d128b179e9 Not call functions when the eventstate is null 2024-04-12 08:59:10 -03:00
Germano Cavalcante d3a1752cdf Reuse last `event_modifier` if `win->eventstate` is `nullptr`
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
2024-04-11 10:13:50 -03:00
Germano Cavalcante 279bc37c16 Merge remote-tracking branch 'origin/main' into fix_118694 2024-04-11 09:40:37 -03:00
Germano Cavalcante af30f9d6b6 Pass `event->modifier` instead of `event` 2024-04-11 09:40:28 -03:00
Germano Cavalcante db9a32734a Fix #118694: snap cursor sometimes doesn't update when dragging and dropping assets
The problem happens because, on some OSs, `wm->winactive->eventstate`
does not update when the mouse moves. So the snap cursor doesn't update
because apparently the mouse didn't move.

The solution in this commit is to use the `eventstate` of the window in
the context (`CTX_wm_window(C)->eventstate`).

This matches other code snippets where `eventstate` is used.

---
The behavior on each OS apparently happens like this:
**Windows:**
- `wm->winactive` is updated if the cursor is over the window for a little less than 1 second
- Events are sent to the window whose cursor is over.

**MacOS:**
- `wm->winactive` is the last one selected
- Events are sent to the active window and to the one whose cursor is over.

**Linux:**
- `wm->winactive` is the last one selected
- Events are sent to the window whose cursor is over.

Therefore, we cannot trust the eventstate of `wm->winactive`.
2024-04-10 10:35:48 -03:00