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,12 +448,13 @@ Manager_moveWindow() {
} }
Manager_onDisplayChange(a, wParam, uMsg, lParam) { 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) Debug_logMessage("DEBUG[1] Manager_onDisplayChange( a: " . a . ", uMsg: " . uMsg . ", wParam: " . wParam . ", lParam: " . lParam . " )", 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." 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 IfMsgBox Yes
Manager_resetMonitorConfiguration() doChange := True
Else IfMsgBox No Else IfMsgBox No
{ {
Loop, % Manager_monitorCount { Loop, % Manager_monitorCount {
@ -464,6 +465,10 @@ Manager_onDisplayChange(a, wParam, uMsg, lParam) {
Bar_updateTitle() Bar_updateTitle()
} }
} }
If (doChange) {
Manager_resetMonitorConfiguration()
}
}
/* /*
Possible indications for a ... Possible indications for a ...
@ -679,7 +684,7 @@ Manager_registerShellHook() {
Debug_logMessage("DEBUG[1] Manager_registerShellHook; hWnd: " . hWnd . ", wndClass: " . wndClass . ", wndTitle: " . wndTitle, 1) Debug_logMessage("DEBUG[1] Manager_registerShellHook; hWnd: " . hWnd . ", wndClass: " . wndClass . ", wndTitle: " . wndTitle, 1)
msgNum := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK") msgNum := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK")
OnMessage(msgNum, "Manager_onShellMessage") OnMessage(msgNum, "Manager_onShellMessage")
If Config_monitorDisplayChangeMessages If !(Config_monitorDisplayChangeMessages = "off" || Config_monitorDisplayChangeMessages = 0)
OnMessage(WM_DISPLAYCHANGE, "Manager_onDisplayChange") 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) ;; SKAN: How to Hook on to Shell to receive its messages? (http://www.autohotkey.com/forum/viewtopic.php?p=123323#123323)