X-Git-Url: http://pileus.org/git/?p=wmpus;a=blobdiff_plain;f=sys-win32.c;h=ba3a7e9c9bb04f70701bb286d8554e8958a062ac;hp=04e4ef4e52d75978520751034339291d9f431d0a;hb=bdfa912aef69869a2385d65d5e8486080fc66895;hpb=eefa2034ad0f5c2ef5eb478984cfc53a6a40c6b7 diff --git a/sys-win32.c b/sys-win32.c index 04e4ef4..ba3a7e9 100644 --- a/sys-win32.c +++ b/sys-win32.c @@ -324,9 +324,13 @@ void sys_focus(win_t *win) * certain circumstances and instead flashes the windows toolbar icon. * Attaching the thread input queues avoids this behavior */ DWORD oldId = GetWindowThreadProcessId(GetForegroundWindow(), NULL); - DWORD newId = GetWindowThreadProcessId(win->sys->hwnd, NULL); + DWORD newId = GetCurrentThreadId(); AttachThreadInput(oldId, newId, TRUE); + + BringWindowToTop(win->sys->hwnd); SetForegroundWindow(win->sys->hwnd); + SetFocus(win->sys->hwnd); + AttachThreadInput(oldId, newId, FALSE); }