netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Check for EnvVar/SysProp for preferred screen

Open errael opened this issue 2 years ago • 2 comments

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 that KeyboardFocusManager.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.

errael avatar Oct 01 '22 18:10 errael

Updated to ready for review. Though it's a simple patch, the idea of giving the user a way to specify which screen to start up in is new (AFAIK).

errael avatar Oct 10 '22 15:10 errael

My inclination would be to try and use the display that NetBeans was on when last used rather than adding additional configuration options if at all possible.

neilcsmith-net avatar Oct 11 '22 10:10 neilcsmith-net

My inclination would be to try and use the display that NetBeans was on when last used rather than adding additional configuration options if at all possible.

I don't disagree, especially considering how to document/expose it so it's actually useful.

errael avatar Oct 17 '22 15:10 errael

Forget the Env var. Focus on mis-use of null parent for dialog placement through NB APIs in a future PR.

errael avatar Jan 09 '23 20:01 errael