From d26791d2cfe6250e855befe9134580a58f78f8e8 Mon Sep 17 00:00:00 2001 From: joten Date: Sun, 25 Jan 2015 19:38:10 +0100 Subject: [PATCH] Renamed window-related global variables --- src/Bar.ahk | 2 +- src/Debug.ahk | 12 +++++----- src/Manager.ahk | 60 ++++++++++++++++++++++++------------------------- src/Monitor.ahk | 22 +++++++++--------- src/View.ahk | 10 ++++----- src/Window.ahk | 4 ++-- 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/Bar.ahk b/src/Bar.ahk index 8fececf..24c134a 100644 --- a/src/Bar.ahk +++ b/src/Bar.ahk @@ -482,7 +482,7 @@ Bar_updateTitle() WinGetTitle, aWndTitle, ahk_id %aWndId% If InStr(Bar_hideTitleWndIds, aWndId ";") Or (aWndTitle = "bug.n_BAR_0") aWndTitle := "" - If Manager_#%aWndId%_isFloating + If Window_#%aWndId%_isFloating aWndTitle := "~ " aWndTitle If (Manager_monitorCount > 1) aWndTitle := "[" Manager_aMonitor "] " aWndTitle diff --git a/src/Debug.ahk b/src/Debug.ahk index 0aa1858..03ef4cc 100644 --- a/src/Debug.ahk +++ b/src/Debug.ahk @@ -94,11 +94,11 @@ Debug_logViewWindowList() Debug_logWindowInfo(wndId) { - Local aWndId, detect_state, text, v + Local aWndId, detectSetting, text, v Local isBugnActive, isDecorated, isFloating, isGhost, isHidden, isResponsive, isWinFocus Local wndClass, wndH, wndProc, wndStyle, wndTitle, wndW, wndX, wndY - detect_state := A_DetectHiddenWindows + detectSetting := A_DetectHiddenWindows DetectHiddenWindows, On WinGet, aWndId, ID, A If aWndId = %wndId% @@ -117,11 +117,11 @@ Debug_logWindowInfo(wndId) isHidden := "*" Else isHidden := " " - If Manager_#%wndId%_isFloating + If Window_#%wndId%_isFloating isFloating := "*" Else isFloating := " " - If Manager_#%wndId%_isDecorated + If Window_#%wndId%_isDecorated isDecorated := "*" Else isDecorated := " " @@ -131,7 +131,7 @@ Debug_logWindowInfo(wndId) isGhost := "*" Else isGhost := " " - DetectHiddenWindows, %detect_state% + DetectHiddenWindows, %detectSetting% ;; Intentionally don't detect hidden windows here to see what Manager_hungTest does If Window_isHung(wndId) @@ -141,7 +141,7 @@ Debug_logWindowInfo(wndId) text := wndId "`t" text .= isHidden " " isWinFocus " " isBugnActive " " isFloating " " isDecorated " " isResponsive " " isGhost " " - text .= Manager_#%wndId%_monitor "`t" Manager_#%wndId%_tags "`t" + text .= Window_#%wndId%_monitor "`t" Window_#%wndId%_tags "`t" text .= wndX "`t" wndY "`t" wndW "`t" wndH "`t" wndStyle "`t" wndProc " / " wndClass " / " wndTitle Debug_logMessage(text , 0, False) } diff --git a/src/Manager.ahk b/src/Manager.ahk index 95f5543..e90fc6e 100644 --- a/src/Manager.ahk +++ b/src/Manager.ahk @@ -264,7 +264,7 @@ Manager_getWindowInfo() rule .= ";1" Else rule .= ";0" - rule .= ";" Manager_#%aWndId%_monitor ";" Manager_#%aWndId%_tags ";" Manager_#%aWndId%_isFloating ";" Manager_#%aWndId%_isDecorated + rule .= ";" Window_#%aWndId%_monitor ";" Window_#%aWndId%_tags ";" Window_#%aWndId%_isFloating ";" Window_#%aWndId%_isDecorated If InStr(Bar_hiddenWndIds, aWndId) { text .= " (hidden)" rule .= ";1;" @@ -272,8 +272,8 @@ Manager_getWindowInfo() rule .= ";0;" If (aWndMinMax = 1) rule .= "maximize" - text .= "`nprocess:`t" aWndProcessName "`nstyle:`t" aWndStyle "`nmetrics:`tx: " aWndX ", y: " aWndY ", width: " aWndWidth ", height: " aWndHeight "`ntags:`t" Manager_#%aWndId%_tags - If Manager_#%aWndId%_isFloating + text .= "`nprocess:`t" aWndProcessName "`nstyle:`t" aWndStyle "`nmetrics:`tx: " aWndX ", y: " aWndY ", width: " aWndWidth ", height: " aWndHeight "`ntags:`t" Window_#%aWndId%_tags + If Window_#%aWndId%_isFloating text .= " (floating)" text .= "`n`n" rule MsgBox, 260, bug.n: Window Information, % text "`n`nCopy text to clipboard?" @@ -342,17 +342,17 @@ Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hi Manager_managedWndIds .= wndId ";" Monitor_moveWindow(m, wndId) - Manager_#%wndId%_tags := tags - Manager_#%wndId%_isDecorated := isDecorated - Manager_#%wndId%_isFloating := isFloating - Manager_#%wndId%_area := 0 + Window_#%wndId%_tags := tags + Window_#%wndId%_isDecorated := isDecorated + Window_#%wndId%_isFloating := isFloating + Window_#%wndId%_area := 0 If Not Config_showBorder Window_set(wndId, "Style", "-0x40000") - If Not Manager_#%wndId%_isDecorated + If Not Window_#%wndId%_isDecorated Window_set(wndId, "Style", "-0xC00000") - a := Manager_#%wndId%_tags & (1 << (Monitor_#%m%_aView_#1 - 1)) + a := Window_#%wndId%_tags & (1 << (Monitor_#%m%_aView_#1 - 1)) If a { ;; A newly created window defines the active monitor, if it is visible. @@ -391,10 +391,10 @@ Manager_manage(preferredMonitor, preferredView, wndId) If body { isManaged := InStr(Manager_managedWndIds, body ";") - m := Manager_#%body%_monitor - tags := Manager_#%body%_tags - isDecorated := Manager_#%body%_isDecorated - isFloating := Manager_#%body%_isFloating + m := Window_#%body%_monitor + tags := Window_#%body%_tags + isDecorated := Window_#%body%_isDecorated + isFloating := Window_#%body%_isFloating hideTitle := InStr(Bar_hideTitleWndIds, body ";") action := "" } @@ -423,7 +423,7 @@ Manager_manage(preferredMonitor, preferredView, wndId) ; Do view placement. If isManaged { Loop, % Config_viewCount - If (Manager_#%wndId%_tags & (1 << (A_Index - 1))) { + If (Window_#%wndId%_tags & (1 << (A_Index - 1))) { If (body) { ; Try to position near the body. View_ghostWindow(m, A_Index, body, wndId) @@ -443,7 +443,7 @@ Manager_maximizeWindow() WinGet, aWndId, ID, A v := Monitor_#%Manager_aMonitor%_aView_#1 l := View_#%Manager_aMonitor%_#%v%_layout_#1 - If Not Manager_#%aWndId%_isFloating And Not (Config_layoutFunction_#%l% = "") + If Not Window_#%aWndId%_isFloating And Not (Config_layoutFunction_#%l% = "") View_toggleFloating() Window_set(aWndId, "Top", "") @@ -457,7 +457,7 @@ Manager_moveWindow() WinGet, aWndId, ID, A v := Monitor_#%Manager_aMonitor%_aView_#1 l := View_#%Manager_aMonitor%_#%v%_layout_#1 - If Not Manager_#%aWndId%_isFloating And Not (Config_layoutFunction_#%l% = "") + If Not Window_#%aWndId%_isFloating And Not (Config_layoutFunction_#%l% = "") View_toggleFloating() Window_set(aWndId, "Top", "") @@ -588,11 +588,11 @@ Manager_onShellMessage(wParam, lParam) { wndId := SubStr(wndIds, 1, InStr(wndIds, ";") - 1) Loop, % Config_viewCount { - If (Manager_#%wndId%_tags & 1 << A_Index - 1) + If (Window_#%wndId%_tags & 1 << A_Index - 1) { Debug_logMessage("DEBUG[3] Switching views because " . wndId . " is considered hidden and active", 3) ;; A newly created window defines the active monitor, if it is visible. - Manager_aMonitor := Manager_#%wndId%_monitor + Manager_aMonitor := Window_#%wndId%_monitor Monitor_activateView(A_Index) Break } @@ -618,7 +618,7 @@ Manager_onShellMessage(wParam, lParam) { wndId := wndId%A_Index% View_#%Manager_aMonitor%_#%t%_wndIds := wndId ";" View_#%Manager_aMonitor%_#%t%_wndIds View_#%Manager_aMonitor%_#%t%_aWndId := wndId - Manager_#%wndId%_tags += 1 << t - 1 + Window_#%wndId%_tags += 1 << t - 1 } Bar_updateView(Manager_aMonitor, t) If Config_dynamicTiling @@ -749,7 +749,7 @@ Manager_setViewMonitor(d) } Monitor_moveWindow(m, A_LoopField) - Manager_#%A_LoopField%_tags := 1 << v - 1 + Window_#%A_LoopField%_tags := 1 << v - 1 } View_arrange(Manager_aMonitor, aView) Loop, % Config_viewCount @@ -814,7 +814,7 @@ Manager_setWindowMonitor(d) Manager_aMonitor := Manager_loop(Manager_aMonitor, d, 1, Manager_monitorCount) Monitor_moveWindow(Manager_aMonitor, aWndId) v := Monitor_#%Manager_aMonitor%_aView_#1 - Manager_#%aWndId%_tags := 1 << v - 1 + Window_#%aWndId%_tags := 1 << v - 1 View_#%Manager_aMonitor%_#%v%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%v%_wndIds View_#%Manager_aMonitor%_#%v%_aWndId := aWndId If Config_dynamicTiling @@ -831,7 +831,7 @@ Manager_sizeWindow() WinGet, aWndId, ID, A v := Monitor_#%Manager_aMonitor%_aView_#1 l := View_#%Manager_aMonitor%_#%v%_layout_#1 - If Not Manager_#%aWndId%_isFloating And Not (Config_layoutFunction_#%l% = "") + If Not Window_#%aWndId%_isFloating And Not (Config_layoutFunction_#%l% = "") View_toggleFloating() Window_set(aWndId, "Top", "") @@ -932,7 +932,7 @@ Manager_saveWindowState(filename, nm, nv) Else isTitleHidden := 0 - text .= "Window " . wndId . ";" . process . ";" . Manager_#%wndId%_monitor . ";" . Manager_#%wndId%_tags . ";" . Manager_#%wndId%_isFloating . ";" . Manager_#%wndId%_isDecorated . ";" . isTitleHidden . ";" . isManaged . ";" . title . "`n" + text .= "Window " . wndId . ";" . process . ";" . Window_#%wndId%_monitor . ";" . Window_#%wndId%_tags . ";" . Window_#%wndId%_isFloating . ";" . Window_#%wndId%_isDecorated . ";" . isTitleHidden . ";" . isManaged . ";" . title . "`n" } DetectHiddenWindows, Off @@ -1167,20 +1167,20 @@ Manager_unmanage(wndId) { ;; Do our best to make sure that any unmanaged windows are left visible. Window_show(wndId) - a := Manager_#%wndId%_tags & 1 << Monitor_#%Manager_aMonitor%_aView_#1 - 1 + a := Window_#%wndId%_tags & 1 << Monitor_#%Manager_aMonitor%_aView_#1 - 1 Loop, % Config_viewCount { - If (Manager_#%wndId%_tags & 1 << A_Index - 1) + If (Window_#%wndId%_tags & 1 << A_Index - 1) { StringReplace, View_#%Manager_aMonitor%_#%A_Index%_wndIds, View_#%Manager_aMonitor%_#%A_Index%_wndIds, %wndId%`;, Bar_updateView(Manager_aMonitor, A_Index) } } - Manager_#%wndId%_monitor := - Manager_#%wndId%_tags := - Manager_#%wndId%_isDecorated := - Manager_#%wndId%_isFloating := - Manager_#%wndId%_area := + Window_#%wndId%_monitor := + Window_#%wndId%_tags := + Window_#%wndId%_isDecorated := + Window_#%wndId%_isFloating := + Window_#%wndId%_area := StringReplace, Bar_hideTitleWndIds, Bar_hideTitleWndIds, %wndId%`;, StringReplace, Manager_allWndIds, Manager_allWndIds, %wndId%`;, StringReplace, Manager_managedWndIds, Manager_managedWndIds, %wndId%`;, , All diff --git a/src/Monitor.ahk b/src/Monitor.ahk index e363a0c..8f20123 100644 --- a/src/Monitor.ahk +++ b/src/Monitor.ahk @@ -77,7 +77,7 @@ Monitor_activateView(v) StringTrimRight, wndIds, View_#%m%_#%aView%_wndIds, 1 Loop, PARSE, wndIds, `; { - If Not (Manager_#%A_LoopField%_tags & (1 << v - 1)) + If Not (Window_#%A_LoopField%_tags & (1 << v - 1)) Window_hide(A_LoopField) } SetWinDelay, 10 @@ -88,7 +88,7 @@ Monitor_activateView(v) SetWinDelay, 0 Loop, PARSE, wndIds, `; { - Manager_winShow(A_LoopField) + Window_show(A_LoopField) } SetWinDelay, 10 Manager_hideShow := False @@ -211,7 +211,7 @@ Monitor_moveWindow(m, wndId) { Global - Manager_#%wndId%_monitor := m + Window_#%wndId%_monitor := m } Monitor_setWindowTag(t) @@ -230,12 +230,12 @@ Monitor_setWindowTag(t) { Loop, % Config_viewCount { - If Not (Manager_#%aWndId%_tags & (1 << A_Index - 1)) + If Not (Window_#%aWndId%_tags & (1 << A_Index - 1)) { View_#%Manager_aMonitor%_#%A_Index%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%A_Index%_wndIds View_#%Manager_aMonitor%_#%A_Index%_aWndId := aWndId Bar_updateView(Manager_aMonitor, A_Index) - Manager_#%aWndId%_tags += 1 << A_Index - 1 + Window_#%aWndId%_tags += 1 << A_Index - 1 } } } @@ -251,10 +251,10 @@ Monitor_setWindowTag(t) } } - If Not (Manager_#%aWndId%_tags & (1 << t - 1)) + If Not (Window_#%aWndId%_tags & (1 << t - 1)) View_#%Manager_aMonitor%_#%t%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%t%_wndIds View_#%Manager_aMonitor%_#%t%_aWndId := aWndId - Manager_#%aWndId%_tags := 1 << t - 1 + Window_#%aWndId%_tags := 1 << t - 1 aView := Monitor_#%Manager_aMonitor%_aView_#1 If Not (t = aView) @@ -342,11 +342,11 @@ Monitor_toggleWindowTag(t) WinGet, aWndId, ID, A If (InStr(Manager_managedWndIds, aWndId ";") And t >= 0 And t <= Config_viewCount) { - If (Manager_#%aWndId%_tags & (1 << t - 1)) + If (Window_#%aWndId%_tags & (1 << t - 1)) { - If Not ((Manager_#%aWndId%_tags - (1 << t - 1)) = 0) + If Not ((Window_#%aWndId%_tags - (1 << t - 1)) = 0) { - Manager_#%aWndId%_tags -= 1 << t - 1 + Window_#%aWndId%_tags -= 1 << t - 1 StringReplace, View_#%Manager_aMonitor%_#%t%_wndIds, View_#%Manager_aMonitor%_#%t%_wndIds, %aWndId%`;, Bar_updateView(Manager_aMonitor, t) If (t = Monitor_#%Manager_aMonitor%_aView_#1) @@ -366,7 +366,7 @@ Monitor_toggleWindowTag(t) View_#%Manager_aMonitor%_#%t%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%t%_wndIds View_#%Manager_aMonitor%_#%t%_aWndId := aWndId Bar_updateView(Manager_aMonitor, t) - Manager_#%aWndId%_tags += 1 << t - 1 + Window_#%aWndId%_tags += 1 << t - 1 } } } diff --git a/src/View.ahk b/src/View.ahk index 335263f..f11e6f4 100644 --- a/src/View.ahk +++ b/src/View.ahk @@ -52,7 +52,7 @@ View_activateWindow(d) Debug_logMessage("DEBUG[2] wndId count: " . wndId0, 2, False) If (wndId0 > 1) { - If Manager_#%aWndId%_isFloating + If Window_#%aWndId%_isFloating Window_set(aWndId, "Bottom", "") Loop, % wndId0 { @@ -325,7 +325,7 @@ View_getTiledWndIds(m, v) StringTrimRight, wndIds, View_#%m%_#%v%_wndIds, 1 Loop, PARSE, wndIds, `; { - If Not Manager_#%A_LoopField%_isFloating And WinExist("ahk_id " A_LoopField) and Not Window_isHung(A_LoopField) + If Not Window_#%A_LoopField%_isFloating And WinExist("ahk_id " A_LoopField) and Not Window_isHung(A_LoopField) { n += 1 tiledWndIds .= A_LoopField ";" @@ -355,9 +355,9 @@ View_moveWindow(i=0, d=0) { l := View_#%Manager_aMonitor%_#%v%_layout_#1 If (Config_layoutFunction_#%l% = "tile" And InStr(Manager_managedWndIds, aWndId ";") And Not (i = 0 And d = 0) And i <= View_#%m%_#%v%_area_#0) { If (i = 0) - i := Manager_loop(Manager_#%aWndId%_area, d, 1, View_#%m%_#%v%_area_#0) + i := Manager_loop(Window_#%aWndId%_area, d, 1, View_#%m%_#%v%_area_#0) Window_move(aWndId, View_#%m%_#%v%_area_#%i%_x, View_#%m%_#%v%_area_#%i%_y, View_#%m%_#%v%_area_#%i%_width, View_#%m%_#%v%_area_#%i%_height) - Manager_#%aWndId%_area := i + Window_#%aWndId%_area := i If Config_mouseFollowsFocus { WinGetPos, aWndX, aWndY, aWndWidth, aWndHeight, ahk_id %aWndId% DllCall("SetCursorPos", "Int", Round(aWndX + aWndWidth / 2), "Int", Round(aWndY + aWndHeight / 2)) @@ -735,7 +735,7 @@ View_toggleFloating() l := View_#%Manager_aMonitor%_#%v%_layout_#1 If (Config_layoutFunction_#%l% And InStr(Manager_managedWndIds, aWndId ";")) { - Manager_#%aWndId%_isFloating := Not Manager_#%aWndId%_isFloating + Window_#%aWndId%_isFloating := Not Window_#%aWndId%_isFloating View_arrange(Manager_aMonitor, v) Bar_updateTitle() } diff --git a/src/Window.ahk b/src/Window.ahk index 8b5378b..c36fe5a 100644 --- a/src/Window.ahk +++ b/src/Window.ahk @@ -165,8 +165,8 @@ Window_toggleDecor(wndId = 0) { If (wndId = 0) WinGet, wndId, ID, A - Manager_#%wndId%_isDecorated := Not Manager_#%wndId%_isDecorated - If Manager_#%wndId%_isDecorated + Window_#%wndId%_isDecorated := Not Window_#%wndId%_isDecorated + If Window_#%wndId%_isDecorated Window_set(wndId, "Style", "+0xC00000") Else Window_set(wndId, "Style", "-0xC00000")