From: Andy Spencer Date: Thu, 29 Sep 2011 08:01:06 +0000 (+0000) Subject: Improve sys_focus on win32 X-Git-Url: http://pileus.org/git/?p=wmpus;a=commitdiff_plain;h=8bcaf951a632cdadb149b7b6e53c94f666146afb Improve sys_focus on win32 --- 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); }