]> Pileus Git - wmpus/commitdiff
Improve sys_focus on win32
authorAndy Spencer <andy753421@gmail.com>
Thu, 29 Sep 2011 08:01:06 +0000 (08:01 +0000)
committerAndy Spencer <andy753421@gmail.com>
Fri, 30 Sep 2011 03:34:54 +0000 (03:34 +0000)
sys-win32.c

index 04e4ef4e52d75978520751034339291d9f431d0a..ba3a7e9c9bb04f70701bb286d8554e8958a062ac 100644 (file)
@@ -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);
 }