Requesting cursor position from window doesn't return expected result #9622
Labels
A-Input
Player input via keyboard, mouse, gamepad, and more
A-Windowing
Platform-agnostic interface layer to run your app in
C-Bug
An unexpected or incorrect behavior
S-Blocked
This cannot move forward until something else changes
I'm trying to implement drag and drop between two separate windows and came across something that i think might be a bug.
I'm iterating over all windows to check whether the window contains the cursor or not. This usually works as expected and
window.cursor_position()
returns the position of the cursor if it hovers the window. But if you start a drag in one window and move the mouse over to another windowwindow.cursor_position()
will return None for all windows except for the window where you started your drag. This behavior is shared by events likeCursorMoved
,CursorEntered
andCursorLeft
where the leave and enter events are not fired until you release the mouse button.One could argue that regarding the events this is expected and wanted behavior since this is the exact behavior in Winit. But i think that when we request the cursor position from a window in Bevy it should return the position regardless if we initiated a drag in another window.
Requesting cursor position test in Bevy:
Testing Winit cursor events:
Workaround
I thought there might be some sort of workaround where you just calculate the bounds of all windows and check if the mouse is inside. But then we get to the z-ordering issue and it does not seem to be possible to get the z-order of a window in
Bevy
orWinit
.If someone have an idea here I would appreciate it because right now I'm stuck...
System information
OS: Windows 11
Bevy version: 0.11.2
Winit version: 0.28.6 (for the winit test)
The text was updated successfully, but these errors were encountered: