Fix floating panels position resetting in multi-monitor extended mode #16079
+78
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #15498 , fix #16077 (partially, there are two different issues reported in it)
This fixes a regression caused by the PR #15236 (Fix for the "lost" panels problem).
Since the Virtual Screen in extended multi-monitor mode can start not only at 0,0 (like the primary monitor) but also at negative coordinates, we have to deal with this.
The MS Virtual Screen concept ref: https://learn.microsoft.com/en-us/windows/win32/gdi/the-virtual-screen
New
isWindowVisibleOnAnyMonitor
func will ensure that only those saved coordinates of the floating panels from the config.xml file, which will correspond to the current detected "green area" in the image below, will be considered correct. Others will be reset to some default size and moved to the current primary monitor.The
isWindowVisibleOnAnyMonitor
can be also used in the future when resolving issues like # 15769 (on-the-fly disconnecting of the monitor where the main N++ window is). It will be enough to add the the WM_DISPLAYCHANGE message handler to the "NppBigSwitch.cpp" and call there this new func (& possibly react in the same way as here by repositioning the N++ app window to the current primary monitor). Similar stuff is already in use here.