On Fri Nov 7 16:09:35 2025 +0000, Rémi Bernon wrote:
Rather than doing that unconditionally, which may not be always correct (it's not because the window is the thread's active window that it's also the current foreground window), I think this should be dependent on what is currently happening. I understand that the issue exists when WM_ACTIVATE message is being sent, which happens during window activation and deactivation (with different wparam), and we only want to prevent re-activation if the window is being deactivated, not in other cases.
Sorry for the late reply. What would you suggest for keeping track of when the window is being deactivated? Should I add a new flag to the tagWND struct and set it in `set_active_window`?
Also I found that, on Windows, calling SetActiveWindow directly while handling WM_ACTIVATE doesn't work, however calling SetForegroundWindow does work to activate the window, but it doesn't send a `WM_ACTIVATE` message with 0 wparam when it gets deactivated again which is weird.