moved Manager_log*-functions to 'Debug.ahk'

This commit is contained in:
joten 2012-10-03 19:27:58 +02:00
parent a1ace64721
commit 81556d4224
3 changed files with 110 additions and 111 deletions

View file

@ -366,11 +366,11 @@ Config_saveSession()
#+i::Manager_getWindowList() #+i::Manager_getWindowList()
;; Window debugging ;; Window debugging
#^i::Manager_logViewWindowList() #^i::Debug_logViewWindowList()
#+^i::Manager_logManagedWindowList() #+^i::Debug_logManagedWindowList()
#^h::Manager_logHelp() #^h::Debug_logHelp()
#^l::Debug_setLogLevel(-1) #^d::Debug_setLogLevel(-1)
#^+l::Debug_setLogLevel(+1) #^+d::Debug_setLogLevel(+1)
;; Layout management ;; Layout management
#Tab::View_setLayout(-1) #Tab::View_setLayout(-1)

View file

@ -30,6 +30,42 @@ Debug_initLog(filename, level = 0, truncateFile = True)
Debug_logMessage("Log initialized.", 0) Debug_logMessage("Log initialized.", 0)
} }
Debug_logHelp()
{
Debug_logMessage("Help Display")
Debug_logMessage("Window list columns", 0)
Debug_logMessage(" ID - Windows ID. Unique, OS-assigned ID", 0)
Debug_logMessage(" H - Hidden. Whether bug.n thinks this window is hidden.", 0)
Debug_logMessage(" W - Windows active. This window is active according to Windows.", 0)
Debug_logMessage(" A - View active. This window is active according to bug.n.", 0)
Debug_logMessage(" F - Floating. This window should not be positioned and resized by the layout.", 0)
Debug_logMessage(" D - Decorated. Does the window have a title bar?", 0)
Debug_logMessage(" R - Responsive. Is responding to messages?", 0)
Debug_logMessage(" G - Ghost. Is this window a ghost of another hung window?", 0)
Debug_logMessage(" M - Monitor number.", 0)
Debug_logMessage(" Tags - Bit-mask of the views in which the window is active.", 0)
Debug_logMessage(" X - Windows X position.", 0)
Debug_logMessage(" Y - Windows Y position.", 0)
Debug_logMessage(" W - Windows width.", 0)
Debug_logMessage(" H - Windows height.", 0)
Debug_logMessage(" Style - Windows style.", 0)
Debug_logMessage(" Proc / Class / Title - Process/Class/Title of the window.", 0)
}
Debug_logManagedWindowList()
{
Local wndIds
Debug_logMessage("Window dump for manager")
Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
StringTrimRight, wndIds, Manager_managedWndIds, 1
Loop, PARSE, wndIds, `;
{
Debug_logWindowInfo(A_LoopField)
}
}
Debug_logMessage(text, level = 1, includeTimestamp = True) Debug_logMessage(text, level = 1, includeTimestamp = True)
{ {
Global Debug_logFilename, Debug_logLevel Global Debug_logFilename, Debug_logLevel
@ -47,6 +83,75 @@ Debug_logMessage(text, level = 1, includeTimestamp = True)
} }
} }
Debug_logViewWindowList()
{
Local v, wndIds
v := Monitor_#%Manager_aMonitor%_aView_#1
Debug_logMessage("Window dump for active view (" . Manager_aMonitor . ", " . v . ")")
Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1
Loop, PARSE, wndIds, `;
{
Debug_logWindowInfo(A_LoopField)
}
}
Debug_logWindowInfo(wndId)
{
Local aWndId, detect_state, text, v
Local isBugnActive, isDecorated, isFloating, isGhost, isHidden, isResponsive, isWinFocus
Local wndClass, wndH, wndProc, wndStyle, wndTitle, wndW, wndX, wndY
detect_state := A_DetectHiddenWindows
DetectHiddenWindows, On
WinGet, aWndId, ID, A
If aWndId = %wndId%
isWinFocus := "*"
Else
isWinFocus := " "
v := Monitor_#%Manager_aMonitor%_aView_#1
If View_#%Manager_aMonitor%_#%v%_aWndId = %wndId%
isBugnActive := "*"
Else
isBugnActive := " "
WinGetTitle, wndTitle, ahk_id %wndId%
WinGetClass, wndClass, ahk_id %wndId%
WinGet, wndProc, ProcessName, ahk_id %wndId%
If InStr(Bar_hiddenWndIds, wndId)
isHidden := "*"
Else
isHidden := " "
If Manager_#%wndId%_isFloating
isFloating := "*"
Else
isFloating := " "
If Manager_#%wndId%_isDecorated
isDecorated := "*"
Else
isDecorated := " "
WinGet, wndStyle, Style, ahk_id %wndId%
WinGetPos, wndX, wndY, wndW, wndH, ahk_id %wndId%
If Manager_isGhost(wndId)
isGhost := "*"
Else
isGhost := " "
DetectHiddenWindows, %detect_state%
;; Intentionally don't detect hidden windows here to see what Manager_hungTest does
If Manager_isHung(wndId)
isResponsive := " "
Else
isResponsive := "*"
text := wndId "`t"
text .= isHidden " " isWinFocus " " isBugnActive " " isFloating " " isDecorated " " isResponsive " " isGhost " "
text .= Manager_#%wndId%_monitor "`t" Manager_#%wndId%_tags "`t"
text .= wndX "`t" wndY "`t" wndW "`t" wndH "`t" wndStyle "`t" wndProc " / " wndClass " / " wndTitle
Debug_logMessage(text , 0, False)
}
Debug_setLogLevel(d) Debug_setLogLevel(d)
{ {
Global Debug_logLevel Global Debug_logLevel

View file

@ -201,112 +201,6 @@ Manager_getWindowList() {
Clipboard := text Clipboard := text
} }
Manager_logViewLayout() {
}
Manager_logWindowInfo( w ) {
Local v, wndId, isWinFocus, isBugnActive, isFloating, isHidden, isDecorated, isResponsive, isGhost, wndTitle, wndProc, wndClass, wndStyle, wndX, wndY, wndW, wndH, detect_state
detect_state := A_DetectHiddenWindows
DetectHiddenWindows, On
WinGet, wndId, ID, A
If wndId = %w%
isWinFocus := "*"
Else
isWinFocus := " "
v := Monitor_#%Manager_aMonitor%_aView_#1
If View_#%Manager_aMonitor%_#%v%_aWndId = %w%
isBugnActive := "*"
Else
isBugnActive := " "
WinGetTitle, wndTitle, ahk_id %w%
WinGetClass, wndClass, ahk_id %w%
WinGet, wndProc, ProcessName, ahk_id %w%
If InStr(Bar_hiddenWndIds, w)
isHidden := "*"
Else
isHidden := " "
If Manager_#%w%_isFloating
isFloating := "*"
Else
isFloating := " "
If Manager_#%w%_isDecorated
isDecorated := "*"
Else
isDecorated := " "
WinGet, wndStyle, Style, ahk_id %w%
WinGetPos, wndX, wndY, wndW, wndH, ahk_id %w%
If Manager_isGhost(w)
isGhost := "*"
Else
isGhost := " "
DetectHiddenWindows, %detect_state%
; Intentionally don't detect hidden windows here to see what Manager_hungTest does
If Manager_isHung(w)
isResponsive := " "
Else
isResponsive := "*"
Debug_logMessage(w . "`t" . isHidden . " " isWinFocus . " " . isBugnActive . " " . isFloating . " " . isDecorated . " " . isResponsive . " " . isGhost . " " . Manager_#%w%_monitor . "`t" . Manager_#%w%_tags . "`t" . wndX . "`t" . wndY . "`t" . wndW . "`t" . wndH . "`t" . wndStyle . "`t" . wndProc . " / " . wndClass . " / " . wndTitle, 0, False)
}
Manager_logHeader() {
Debug_logMessage( "ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
}
Manager_logViewWindowList() {
Local text, v, aWndId, wndIds, aWndTitle
v := Monitor_#%Manager_aMonitor%_aView_#1
Debug_logMessage( "Window dump for active view (" . Manager_aMonitor . ", " . v . ")" )
Manager_logHeader()
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1
Loop, PARSE, wndIds, `;
{
Manager_logWindowInfo( A_LoopField )
}
}
Manager_logManagedWindowList() {
Local wndIds
Debug_logMessage( "Window dump for manager" )
Manager_logHeader()
StringTrimRight, wndIds, Manager_managedWndIds, 1
Loop, PARSE, wndIds, `;
{
Manager_logWindowInfo( A_LoopField)
}
}
Manager_logHelp() {
Debug_logMessage("Help Display")
Debug_logMessage("Window list columns", 0)
Debug_logMessage(" ID - Windows ID. Unique, OS-assigned ID", 0)
Debug_logMessage(" H - Hidden. Whether bug.n thinks this window is hidden.", 0)
Debug_logMessage(" W - Windows active. This window is active according to Windows.", 0)
Debug_logMessage(" A - View active. This window is active according to bug.n.", 0)
Debug_logMessage(" F - Floating. This window should not be positioned and resized by the layout.", 0)
Debug_logMessage(" D - Decorated. Does the window have a title bar?", 0)
Debug_logMessage(" R - Responsive. Is responding to messages?", 0)
Debug_logMessage(" G - Ghost. Is this window a ghost of another hung window?", 0)
Debug_logMessage(" M - Monitor number.", 0)
Debug_logMessage(" Tags - Bit-mask of the views in which the window is active.", 0)
Debug_logMessage(" X - Windows X position.", 0)
Debug_logMessage(" Y - Windows Y position.", 0)
Debug_logMessage(" W - Windows width.", 0)
Debug_logMessage(" H - Windows height.", 0)
Debug_logMessage(" Style - Windows style.", 0)
Debug_logMessage(" Proc / Class / Title - Process/Class/Title of the window.", 0)
}
Manager_lockWorkStation() { Manager_lockWorkStation() {
Global Config_shellMsgDelay Global Config_shellMsgDelay