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

Ensure the active window gains the keyboard focus #80548

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

garychia
Copy link
Contributor

Fixes #80470
The issue occurred when another window was about to minimize, the currently active window would become inactive temporarily and lose the keyboard focus, and then become active again after the minimizing was complete. However, the active window would not regain the keyboard focus automatically so it would not receive any WM_CHAR message.

My solution is based on this documentation. It mentions the DefWindowProc function sets the keyboard focus to the window being activated and not minimized. This mechanism is not found in the current implementation of DisplayServerWindows::WndProc function.

@groud
Copy link
Member

groud commented Sep 26, 2023

cc @RandomShaper

@RandomShaper RandomShaper modified the milestones: 4.x, 4.3 Nov 2, 2023
@RandomShaper RandomShaper added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Nov 2, 2023
Copy link
Member

@RandomShaper RandomShaper left a comment

Choose a reason for hiding this comment

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

Why is IsIconic() needed?

@garychia
Copy link
Contributor Author

garychia commented Nov 9, 2023

IsIconic() is used to ensure any minimized window being activated does not gain the keyboard focus. According to the remarks section of this page, what I understand is that a window can be activated when it is minimized and allowing a minimized window to gain the keyboard focus may not be an expected behavior.

@akien-mga akien-mga requested a review from bruvzg December 5, 2023 11:57
@akien-mga akien-mga merged commit 92e9bcb into godotengine:master Feb 15, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@garychia garychia deleted the keyboard_focus branch March 2, 2024 11:30
@akien-mga
Copy link
Member

Cherry-picked for 4.2.2.

@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 11, 2024
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.

Issues With Keyboard Inputs While The Script Editor is Floating
8 participants