Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix floating panels position resetting in multi-monitor extended mode #16079

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xomx
Copy link
Contributor

@xomx xomx commented Jan 17, 2025

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.
VirtualScreen-MultiMonitor-upr2

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.

xomx added 2 commits January 17, 2025 01:54
This fixes a regression caused by PR notepad-plus-plus#15236 (Fix for the "lost" panels problem).

As the Virtual Screen in the extended multi-monitor mode can start not a the point 0,0 (as the primary monitor does) but also at some negative coordinates, we have to deal with it.

The MS Virtual Screen concept ref:
 https://learn.microsoft.com/en-us/windows/win32/gdi/the-virtual-screen
@donho donho self-assigned this Jan 18, 2025
@xomx
Copy link
Contributor Author

xomx commented Jan 18, 2025

@donho
I know you are only with your laptop now but you can test any multi-mon issue with the help of such things (like I sometimes did when I worked on this problem while my train travelings :-) ):
https://www.amazon.de/dp/B0D4Z7MR9G
https://www.amazon.de/-/en/Cable-Matters-48Gbps-Adapter-120Hz/dp/B08MSWMXT4

@donho
Copy link
Member

donho commented Jan 18, 2025

@xomx

I know you are only with your laptop now but you can test any multi-mon issue with the help of such things (like I sometimes did when I worked on this problem while my train travelings :-) ):

We still need an external monitor or TV with such adapter right? Or am I missing somethings?

@xomx
Copy link
Contributor Author

xomx commented Jan 18, 2025

@donho

We still need an external monitor or TV with such adapter right?

No. That "dummy plug" IS a monitor itself. Of course, you cannot see a thing if you move e.g. a N++ floating panel on it but it is there and from the WinOS POV it is simply a real monitor.

I owned such an HDMI-plug before, because I once needed to convince a monitor-free Windows server with a powerful graphics card in it that it had a monitor, otherwise we would not be able to run some CUDA-graphics accelerated tasks there.

Then I remembered it when I did not have much time and needed to simulate a multi-mon environment, even though I only had a regular laptop with me.

@donho
Copy link
Member

donho commented Jan 19, 2025

@xomx

No. That "dummy plug" IS a monitor itself. Of course, you cannot see a thing if you move e.g. a N++ floating panel on it but it is there...

That reminds me a joke of Free download RAM: https://downloadmoreram.com/ LOL
My laptop is ASUS ZENBOOK DUO, so I guess it's better than paying a "invisible monitor device" :D

OK I'm gonna review & test your PR and try to integrate it before the v8.7.6 RC.
Thank you for the bug fixing!

@xomx
Copy link
Contributor Author

xomx commented Jan 19, 2025

ASUS ZENBOOK DUO

Nice HW!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants