Windows: Do not auto-focus from our console

Although auto-focus only works between a single Blender instance's
child windows, this does include our own console and we don't want
that. Luckily fixing this only requires a single check for null -
because GetFocus() returns null to us for our console.

Pull Request: https://projects.blender.org/blender/blender/pulls/108362
This commit is contained in:
Harley Acheson
2023-05-28 03:42:13 +02:00
committed by Harley Acheson
parent 71d89dfa81
commit 1b7c6cf150
+3 -2
View File
@@ -1867,9 +1867,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, uint msg, WPARAM wParam,
/* Mouse Tracking is now off. TrackMouseEvent restarts in MouseMove. */
window->m_mousePresent = false;
/* Auto-focus only occurs within Blender windows, not with _other_ applications. */
/* Auto-focus only occurs within Blender windows, not with _other_ applications. We are
* notified of change of focus from our console, but it returns null from GetFocus. */
HWND old_hwnd = ::GetFocus();
if (hwnd != old_hwnd) {
if (old_hwnd && hwnd != old_hwnd) {
HWND new_parent = ::GetParent(hwnd);
HWND old_parent = ::GetParent(old_hwnd);
if (hwnd == old_parent || old_hwnd == new_parent) {