Standardized the switching of "DetectHiddenWindows"

This commit is contained in:
joten 2015-03-01 21:28:41 +01:00
parent 365c6b060f
commit 770349754d
4 changed files with 21 additions and 22 deletions

View file

@ -92,13 +92,12 @@ Debug_logViewWindowList()
}
}
Debug_logWindowInfo(wndId)
{
Local aWndId, detectSetting, text, v
Debug_logWindowInfo(wndId) {
Local aWndId, detectHidden, text, v
Local isBugnActive, isDecorated, isFloating, isGhost, isHidden, isResponsive, isWinFocus
Local wndClass, wndH, wndPId, wndPName, wndStyle, wndTitle, wndW, wndX, wndY
detectSetting := A_DetectHiddenWindows
detectHidden := A_DetectHiddenWindows
DetectHiddenWindows, On
WinGet, aWndId, ID, A
If aWndId = %wndId%
@ -132,7 +131,7 @@ Debug_logWindowInfo(wndId)
isGhost := "*"
Else
isGhost := " "
DetectHiddenWindows, %detectSetting%
DetectHiddenWindows, %detectHidden%
;; Intentionally don't detect hidden windows here to see what Manager_hungTest does
If Window_isHung(wndId)

View file

@ -690,7 +690,7 @@ 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 vidx, widx, i, j, m, v, candidate_set, detectHidden, view_set, excluded_view_set, view_m0, view_v0, view_list0, wnds0, items0, wndPName, view_var, isManaged, isFloating, isDecorated, hideTitle
If Not FileExist(filename)
Return
@ -748,9 +748,10 @@ Manager__restoreWindowState(filename) {
i := items%i%
j := 2
detectHidden := A_DetectHiddenWindows
DetectHiddenWindows, On
WinGet, wndPName, ProcessName, ahk_id %i%
DetectHiddenWindows, Off
DetectHiddenWindows, %detectHidden%
If Not ( items%j% = wndPName ) {
Debug_logMessage("Window ahk_id " . i . " process '" . wndPName . "' doesn't match expected '" . items%j% . "', forgetting this window", 0)
Continue
@ -826,7 +827,7 @@ Manager_saveState() {
}
Manager_saveWindowState(filename, nm, nv) {
Local allWndId0, allWndIds, wndPName, title, text, monitor, wndId, view, isManaged, isTitleHidden
Local allWndId0, allWndIds, detectHidden, wndPName, title, text, monitor, wndId, view, isManaged, isTitleHidden
text := "; bug.n - tiling window management`n; @version " VERSION "`n`n"
@ -837,6 +838,7 @@ Manager_saveWindowState(filename, nm, nv) {
; to recover that window.
StringTrimRight, allWndIds, Manager_allWndIds, 1
StringSplit, allWndId, allWndIds, `;
detectHidden := A_DetectHiddenWindows
DetectHiddenWindows, On
Loop, % allWndId0 {
wndId := allWndId%A_Index%
@ -851,7 +853,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, %detectHidden%
text .= "`n"

View file

@ -33,7 +33,7 @@ Monitor_init(m, doRestore) {
}
Monitor_activateView(i, d = 0) {
Local aView, aWndId, m, n, wndId, wndIds
Local aView, aWndId, detectHidden, m, n, wndId, wndIds
If (i = -1)
i := Monitor_#%Manager_aMonitor%_aView_#2
@ -77,12 +77,13 @@ Monitor_activateView(i, d = 0) {
Window_hide(A_LoopField)
}
SetWinDelay, 10
detectHidden := A_DetectHiddenWindows
DetectHiddenWindows, On
wndId := View_#%m%_#%i%_aWndId
If wndId
Window_set(wndId, "AlwaysOnTop", "On")
View_arrange(m, i)
DetectHiddenWindows, Off
DetectHiddenWindows, %detectHidden%
StringTrimRight, wndIds, View_#%m%_#%i%_wndIds, 1
SetWinDelay, 0
Loop, PARSE, wndIds, `;
@ -266,20 +267,17 @@ Monitor_toggleBar()
Manager_winActivate(Bar_aWndId)
}
Monitor_toggleNotifyIconOverflowWindow()
{
Monitor_toggleNotifyIconOverflowWindow() {
Static wndId
If Not WinExist("ahk_class NotifyIconOverflowWindow")
{
If Not WinExist("ahk_class NotifyIconOverflowWindow") {
WinGet, wndId, ID, A
detectHidden := A_DetectHiddenWindows
DetectHiddenWindows, On
WinShow, ahk_class NotifyIconOverflowWindow
WinActivate, ahk_class NotifyIconOverflowWindow
DetectHiddenWindows, Off
}
Else
{
DetectHiddenWindows, %detectHidden%
} Else {
WinHide, ahk_class NotifyIconOverflowWindow
WinActivate, ahk_id %wndId%
}

View file

@ -96,14 +96,14 @@ Window_isGhost(wndId) {
;; 0 - Not hung
;; 1 - Hung
Window_isHung(wndId) {
Local detectSetting, result, WM_NULL
Local detectHidden, result, WM_NULL
WM_NULL = 0
detectSetting := A_DetectHiddenWindows
detectHidden := A_DetectHiddenWindows
DetectHiddenWindows, On
SendMessage, WM_NULL, , , , ahk_id %wndId%
result := ErrorLevel
DetectHiddenWindows, %detectSetting%
DetectHiddenWindows, %detectHidden%
If result
Return, 1