Updated src/Manager.ahk to reflect #189

Added more options to `Config_monitorDisplayChangeMessages`, allowing bug.n to always react on display changes without asking.
This commit is contained in:
joten 2018-09-04 21:33:26 +02:00 committed by GitHub
parent 01e38248f6
commit 7f50bfeafe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)