diff --git a/bugn.exe b/bugn.exe index 7ffd623..b489044 100644 Binary files a/bugn.exe and b/bugn.exe differ diff --git a/src/Manager.ahk b/src/Manager.ahk index 1fe7ace..a349983 100644 --- a/src/Manager.ahk +++ b/src/Manager.ahk @@ -175,8 +175,18 @@ Manager_closeWindow() { Local aView, aWndId, wndId0, wndIds WinGet, aWndId, ID, A - If Window_isProg(aWndId) + If Window_isProg(aWndId) { + ;; Prior to closing, find the next window that should have focus. + ;; If there is no such window, choose the bar on the same monitor. + aView := Monitor_#%Manager_aMonitor%_aView_#1 + StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%aView%_wndIds, 1 + StringSplit, wndId, wndIds, `; + If (wndId0 >= 2) + View_activateWindow(0, +1) + Else + Manager_winActivate(0) Window_close(aWndId) + } } ; Asynchronous management of various WM properties. @@ -542,7 +552,6 @@ Manager_onShellMessage(wParam, lParam) { Debug_logMessage("DEBUG[1] Manager_onShellMessage: Manager_monitorCount: " Manager_monitorCount ", Manager_aMonitor: " Manager_aMonitor ", m: " m, 1) If m Manager_aMonitor := m - View_setActiveWindow(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, lParam) updateTitleBar := True } Else If (wParam = HSHELL_WINDOWREPLACED) { updateView := Manager_unmanage(lParam) diff --git a/src/Window.ahk b/src/Window.ahk index 7f5fdff..5bf1240 100644 --- a/src/Window.ahk +++ b/src/Window.ahk @@ -78,7 +78,6 @@ Window_isElevated(wndId) { WinGetTitle, wndTitle, ahk_id %wndId% WinSetTitle, ahk_id %wndId%, , % wndTitle " " WinGetTitle, newWndTitle, ahk_id %wndId% - WinSetTitle, ahk_id %wndId%, , % wndTitle Return, (newWndTitle = wndTitle) }