Check for EnvVar/SysProp for preferred screen #4714
Closed
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.
I've been running with this patch for over 6 months (since I started using multiple screens). It allows the user to specify a "preferred screen", this is the screen that NetBeans starts up in. First looks for an environment variable
NETBEANS_PREFERRED_SCREEN, if found use the numeric value as index into ScreenDevices; if not found then try for a SystemProperty by that name.Originally I was considering a PR with this and other fixes for dialogs that open up on the wrong screen, typically that would be screen 0 when NetBeans' main window is on screen 1. I'm opening this as a draft PR, though it could be merged as is, or maybe extended with related changes. It provides some context/reference for stuff I'm looking at. Looking for some opinions/comments about this whole issue.
I've experienced a situation related to what's described in
[platform] DialogDescriptor/NotifyDescriptor and multiple screens, last message April 22, 2022. But I've never seen anything reproducible. I'm beginning to think thatKeyboardFocusManager.getActiveWindow()return null and NetBeans decides to display dialog on default screen. But I can't get it to reproduce.There also dialogs scattered throughout NetBeans that don't specify a parent, they consistently end up on the wrong screen. They could easily be changed to parent off of the NB main window, or with more effort parent from an appropriate screen.