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

Fix Game and editor freeze when clicking on the game's title bar #102744

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hilderin
Copy link
Contributor

@Hilderin Hilderin commented Feb 12, 2025

Ok, that was a tricky problem!! After commetted most of the code in display_server_windows.cpp and embedded_process.cpp and still reproducing the issue, I found out the cause of the problem!! The problem was caused by the fact that the input queues of the editor and the game window were on the same thread. I still don't understand why the issue was visible only when trying to move the floating window, but detaching these input queues fixed the issue.

The reel fix is the addition of these lines in display_server_windows.cpp:

if (p_parent_hwnd) {
	DWORD mainThreadId = GetWindowThreadProcessId(owner_hwnd, nullptr);
	DWORD embeddedThreadId = GetCurrentThreadId();
	AttachThreadInput(embeddedThreadId, mainThreadId, FALSE);
}

The other modifications come from some side effects of the modification. Turns out, that detaching the input queue make the floating window a lot more responsive, causing to see some issues with the starting location passed to the embedded game when using the Floating Window.

Copy link
Contributor

@tetrapod00 tetrapod00 left a comment

Choose a reason for hiding this comment

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

I tested locally and the fix works for me. I can't speak to the code quality.

@bruvzg bruvzg self-requested a review February 12, 2025 06:11
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.

Game and editor freeze when clicking on the game's title bar
2 participants