Added some debugging
+ standardized the switching of "DetectHiddenWindows"
This commit is contained in:
parent
4fd0b98c9b
commit
2fcad88aa9
1 changed files with 15 additions and 5 deletions
|
@ -673,7 +673,8 @@ Manager_restoreWindowBorders()
|
|||
;; If the state is completely different, this function won't do much. However, if restoring from a crash
|
||||
;; or simply restarting bug.n, it should completely recover the window state.
|
||||
Manager__restoreWindowState(filename) {
|
||||
Local vidx, widx, i, j, m, v, candidate_set, view_set, excluded_view_set, view_m0, view_v0, view_list0, wnds0, items0, wndPName, view_var, isManaged, isFloating, isDecorated, hideTitle
|
||||
Local candidate_set, detectHiddenWindows, excluded_view_set, hideTitle, i, isDecorated, isFloating, isManaged, items0, j, m, v
|
||||
Local vidx, view_list0, view_m0, view_set, view_v0, view_var, widx, wndPName, wnds0
|
||||
|
||||
If Not FileExist(filename)
|
||||
Return
|
||||
|
@ -731,9 +732,10 @@ Manager__restoreWindowState(filename) {
|
|||
i := items%i%
|
||||
j := 2
|
||||
|
||||
detectHiddenWindows := DetectHiddenWindows
|
||||
DetectHiddenWindows, On
|
||||
WinGet, wndPName, ProcessName, ahk_id %i%
|
||||
DetectHiddenWindows, Off
|
||||
DetectHiddenWindows, %detectHiddenWindows%
|
||||
If Not ( items%j% = wndPName ) {
|
||||
Debug_logMessage("Window ahk_id " . i . " process '" . wndPName . "' doesn't match expected '" . items%j% . "', forgetting this window", 0)
|
||||
Continue
|
||||
|
@ -809,7 +811,7 @@ Manager_saveState() {
|
|||
}
|
||||
|
||||
Manager_saveWindowState(filename, nm, nv) {
|
||||
Local allWndId0, allWndIds, wndPName, title, text, monitor, wndId, view, isManaged, isTitleHidden
|
||||
Local allWndId0, allWndIds, detectHiddenWindows, isManaged, isTitleHidden, monitor, text, title, wndId, view, wndPName
|
||||
|
||||
text := "; bug.n - tiling window management`n; @version " VERSION "`n`n"
|
||||
|
||||
|
@ -820,6 +822,7 @@ Manager_saveWindowState(filename, nm, nv) {
|
|||
; to recover that window.
|
||||
StringTrimRight, allWndIds, Manager_allWndIds, 1
|
||||
StringSplit, allWndId, allWndIds, `;
|
||||
detectHiddenWindows := DetectHiddenWindows
|
||||
DetectHiddenWindows, On
|
||||
Loop, % allWndId0 {
|
||||
wndId := allWndId%A_Index%
|
||||
|
@ -834,7 +837,7 @@ Manager_saveWindowState(filename, nm, nv) {
|
|||
|
||||
text .= "Window " . wndId . ";" . wndPName . ";" . Window_#%wndId%_monitor . ";" . Window_#%wndId%_tags . ";" . Window_#%wndId%_isFloating . ";" . Window_#%wndId%_isDecorated . ";" . isTitleHidden . ";" . isManaged . ";" . title . "`n"
|
||||
}
|
||||
DetectHiddenWindows, Off
|
||||
DetectHiddenWindows, %detectHiddenWindows%
|
||||
|
||||
text .= "`n"
|
||||
|
||||
|
@ -1019,11 +1022,18 @@ Manager_initial_sync(doRestore) {
|
|||
}
|
||||
|
||||
Manager_unmanage(wndId) {
|
||||
Local a, aView, aWndId
|
||||
Local a, aView, aWndId, detectHiddenWindows, wndClass, wndTitle
|
||||
|
||||
aView := Monitor_#%Manager_aMonitor%_aView_#1
|
||||
a := Window_#%wndId%_tags & 1 << aView - 1
|
||||
|
||||
detectHiddenWindows := DetectHiddenWindows
|
||||
DetectHiddenWindows, On
|
||||
WinGetClass, wndClass, ahk_id %wndId%
|
||||
WinGetTitle, wndTitle, ahk_id %wndId%
|
||||
DetectHiddenWindows, %detectHiddenWindows%
|
||||
Debug_logMessage("DEBUG[3] Manager_unmanage(wndId: " wndId "); class: " wndClass ", title: " wndTitle, 3)
|
||||
|
||||
Loop, % Config_viewCount {
|
||||
If (Window_#%wndId%_tags & 1 << A_Index - 1) {
|
||||
StringReplace, View_#%Manager_aMonitor%_#%A_Index%_wndIds, View_#%Manager_aMonitor%_#%A_Index%_wndIds, % wndId ";",, All
|
||||
|
|
Loading…
Reference in a new issue