Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputEventMouseMotion not sending to proper control #94283

Open
EmilyV99 opened this issue Jul 12, 2024 · 2 comments
Open

InputEventMouseMotion not sending to proper control #94283

EmilyV99 opened this issue Jul 12, 2024 · 2 comments

Comments

@EmilyV99
Copy link

Tested versions

  • Reproducable in v4.2.2.stable.official [15073af]

System information

Godot v4.2.2.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 31.0.12027.9001) - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

Issue description

I'm trying to implement a simple Sudoku grid. Each Cell is a node, and on clicking it, it takes focus. This works fine. It also has custom keyboard input managing to change the focus to other cells with arrowkeys. This also works fine. (Also, multiple cells can be "selected"- focusing a cell selects it, and they are unselected when another cell is focused UNLESS shift is held)

Then I went to implement selecting multiple cells via mouse drag. When I click on a cell, it gets the click event, and takes focus. Then I drag the mouse, and that cell gets Motion events. But if the mouse cursor goes to other cells, that same one cell is still getting all the motion events.

My first thought was "can non-focused cells not get events like that? huh". Except then I happened to try clicking on a cell, holding, and pressing Alt+Tab to switch windows to another window and back (without releasing the mouse at any point). Upon the window coming to the front again, the Motion events fire on whatever node is being hovered over, not only the focused cell. The fact that Alt+Tabbing out and back in changes the behavior here seemed really weird, and definitely points to some sort of bug being here. (Also, it is not just pressing Tab changing the focus- pressing only tab unfocuses the cell (as there is no Next Focus), but that same cell, even unfocused, is still the only cell to get the Motion events!)

Looking through issues, I didn't see anything that sounded specifically like this; though possibly related to #77246 ?

Steps to reproduce

Not sure how to pull out a reproducable section, so, I'll just link my repo (at a specific commit to ensure it remains reproducable): https://github.com/APSudoku/APSudoku/tree/abe60141b363d26b9d94200e094f3bd81496415b

  • Launch, go to the Sudoku tab
  • Click on a cell, it gains focus (drawn in red), and gains selection (blue border, but drawn behind the focus indicator)
  • Drag over other cells while holding click. The most recently hovered cell SHOULD be red and have focus, while every other cell SHOULD remain "selected" - however, this does NOT occur as it should, and instead the originally clicked cell gets all the InputEventMouseMotion, thus nothing else gets selected/focused.
  • While holding click still, Alt+Tab to another window, Alt+Tab back. Suddenly, it functions as it should.

Minimal reproduction project (MRP)

as I said above, not sure how to pull it out much more without a bunch of work. Project is at https://github.com/APSudoku/APSudoku/tree/abe60141b363d26b9d94200e094f3bd81496415b

@kitbdev
Copy link
Contributor

kitbdev commented Jul 13, 2024

@EmilyV99
Copy link
Author

ah, thank you! That thread had the fix I needed. (mouse_entered should in fact do the trick fine, and this issue was already fixed for that event)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants