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

Release mouse button presses on window focus change. #92419

Closed
wants to merge 1 commit into from

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented May 27, 2024

Prevent mouse button from been stuck when Alt-Tabbing.

@bruvzg bruvzg added this to the 4.3 milestone May 27, 2024
@@ -4893,6 +4893,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
void DisplayServerWindows::_process_activate_event(WindowID p_window_id) {
WindowData &wd = windows[p_window_id];
if (wd.activate_state == WA_ACTIVE || wd.activate_state == WA_CLICKACTIVE) {
last_button_state = 0;
Copy link
Contributor

@RedMser RedMser May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this break drag&drop operations across applications? e.g. minimizing a game window, starting a file drag, hovering the mouse over the game window's taskbar icon, then releasing the mouse.

Or after #67531 is merged, drag&drop of Nodes between multiple windows of one game app, switching between them using alt+tab or hovering taskbar icon.

We have another notification for tracking "last Godot window unfocused", which might be a better fit here instead.

Also the button is released both on focus gain and loss for Windows, while only focus loss for the other OS.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not break file dnd, but definitely will break 67531, so I guess getting current state instead of saving way (similar to #92415) might be better option.

@bruvzg
Copy link
Member Author

bruvzg commented May 27, 2024

Superseded by #92424

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

Successfully merging this pull request may close these issues.

3 participants