diff --git a/src/Manager.ahk b/src/Manager.ahk index 7d6b531..f3e5c65 100644 --- a/src/Manager.ahk +++ b/src/Manager.ahk @@ -448,20 +448,25 @@ Manager_moveWindow() { } Manager_onDisplayChange(a, wParam, uMsg, lParam) { - Global + Local doChange := (Config_monitorDisplayChangeMessages = "on") Debug_logMessage("DEBUG[1] Manager_onDisplayChange( a: " . a . ", uMsg: " . uMsg . ", wParam: " . wParam . ", lParam: " . lParam . " )", 1) - MsgBox, 291, , % "Would you like to reset the monitor configuration?`n'No' will only rearrange all active views.`n'Cancel' will result in no change." - IfMsgBox Yes - Manager_resetMonitorConfiguration() - Else IfMsgBox No - { - Loop, % Manager_monitorCount { - View_arrange(A_Index, Monitor_#%A_Index%_aView_#1) - Bar_updateView(A_Index, Monitor_#%A_Index%_aView_#1) + If !(Config_monitorDisplayChangeMessages = "on" || Config_monitorDisplayChangeMessages = "off" || Config_monitorDisplayChangeMessages = 0) { + MsgBox, 291, , % "Would you like to reset the monitor configuration?`n'No' will only rearrange all active views.`n'Cancel' will result in no change." + IfMsgBox Yes + doChange := True + Else IfMsgBox No + { + Loop, % Manager_monitorCount { + View_arrange(A_Index, Monitor_#%A_Index%_aView_#1) + Bar_updateView(A_Index, Monitor_#%A_Index%_aView_#1) + } + Bar_updateStatus() + Bar_updateTitle() } - Bar_updateStatus() - Bar_updateTitle() + } + If (doChange) { + Manager_resetMonitorConfiguration() } } @@ -679,7 +684,7 @@ Manager_registerShellHook() { Debug_logMessage("DEBUG[1] Manager_registerShellHook; hWnd: " . hWnd . ", wndClass: " . wndClass . ", wndTitle: " . wndTitle, 1) msgNum := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK") OnMessage(msgNum, "Manager_onShellMessage") - If Config_monitorDisplayChangeMessages + If !(Config_monitorDisplayChangeMessages = "off" || Config_monitorDisplayChangeMessages = 0) OnMessage(WM_DISPLAYCHANGE, "Manager_onDisplayChange") } ;; SKAN: How to Hook on to Shell to receive its messages? (http://www.autohotkey.com/forum/viewtopic.php?p=123323#123323) @@ -1227,4 +1232,4 @@ Manager_winActivate(wndId) { Manager_windowNotMaximized(width, height) { Global Return, (width < 0.99 * Monitor_#%Manager_aMonitor%_width Or height < 0.99 * Monitor_#%Manager_aMonitor%_height) -} \ No newline at end of file +}