diff --git a/bugn.exe b/bugn.exe
index 5734c41..f1e2590 100644
Binary files a/bugn.exe and b/bugn.exe differ
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 66098b4..2486378 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -26,6 +26,7 @@ called with the window ID as a paramater, when applying the rule.
11. `+` Added the possibility to minimize windows, making them floating and thereby excluded from tiling.
12. `+` Added configuration variables for customizing the date and time format shown in the status bar.
13. `+` Added a function to override the rules applied from `Config.ini` for the active window.
+14. `+` Added a configuration variable for customizing the behaviour on display change messages.
| # | `-` or `~` Configuration Variables or
`-` Hotkey Functions | `+` Configuration Variables or
`+` Hotkey Functions |
| ---:| ---------------------------------------------------------------- | --------------------------------------------------------- |
@@ -88,6 +89,7 @@ called with the window ID as a paramater, when applying the rule.
| 11. | | `#^m::Manager_minimizeWindow()` |
| 12. | | `Config_readinDateFormat` |
| | | `Config_readinTimeFormat` |
+| 14. | | `Config_monitorDisplayChangeMessages` |
### 8.4.0
diff --git a/doc/Default_configuration.md b/doc/Default_configuration.md
index a6943d9..d9f0a09 100644
--- a/doc/Default_configuration.md
+++ b/doc/Default_configuration.md
@@ -364,3 +364,8 @@ the data directory of bug.n. Possible values are `off`, `auto` and `ask`.
> The interval in milliseconds, in which the session will be automatically
saved to especially support the recovery of window states after bug.n
unintentionally quits.
+
+`Config_monitorDisplayChangeMessages=1`
+> If true (`=1`) bug.n reacts on `WM_DISPLAYCHANGE` system messages asking to
+reset the monitor configuration, e. g. if a monitor is dis-/connected or the
+monitor resolution is changed.
diff --git a/src/Config.ahk b/src/Config.ahk
index 6740a2c..167e86c 100644
--- a/src/Config.ahk
+++ b/src/Config.ahk
@@ -103,6 +103,7 @@ Config_init() {
;; Configuration management
Config_autoSaveSession := "auto" ;; "off" | "auto" | "ask"
Config_maintenanceInterval := 5000
+ Config_monitorDisplayChangeMessages := True
Config_hotkeyCount := 0
Config_restoreConfig(Config_filePath)
diff --git a/src/Manager.ahk b/src/Manager.ahk
index b19202d..50280ed 100644
--- a/src/Manager.ahk
+++ b/src/Manager.ahk
@@ -653,6 +653,8 @@ Manager_override(rule = "") {
}
Manager_registerShellHook() {
+ Global Config_monitorDisplayChangeMessages
+
WM_DISPLAYCHANGE := 126 ;; This message is sent when the display resolution has changed.
Gui, +LastFound
hWnd := WinExist()
@@ -662,7 +664,8 @@ Manager_registerShellHook() {
Debug_logMessage("DEBUG[1] Manager_registerShellHook; hWnd: " . hWnd . ", wndClass: " . wndClass . ", wndTitle: " . wndTitle, 1)
msgNum := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK")
OnMessage(msgNum, "Manager_onShellMessage")
- OnMessage(WM_DISPLAYCHANGE, "Manager_onDisplayChange")
+ If Config_monitorDisplayChangeMessages
+ 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)