Posted by
Sven Gothel on
Dec 21, 2011; 12:51am
URL: https://forum.jogamp.org/glwindow-on-secondary-monitor-tp3593579p3602725.html
On Wednesday, December 21, 2011 12:30:02 AM Sven Gothel wrote:
> On Tuesday, December 20, 2011 11:58:55 PM Triipaxx [via jogamp] wrote:
> >
> > I'm using windows 7 and 2 screens wich are not set up as big display.... so i
> > should have 2 seperate screens.
> > but unfortunately, it's not working.
> > what is working, in certain sitution, is to set the position of the the
> > glwindow to i.e. 1920 in x and 0 in y. than the window is shown on the
> > secondary screen. but this "workarround" only works, if the screens are
> > aligned 0, 1 (primary left, secondary right) if you switch the position of
> > the screens in windows (secondary left, primary right) it is allways shown
> > on the primary monitor. i figured out, that the screen coordinates are
> > negative for the secondary screen. so setting the position will fail what
> > causes the glwindow to be opend on the primary screen.
>
> Thank you for your very thorough decription.
>
> I will try to reproduce this issue now, and hopefully be able to fix it.
>
> Can you add a few more details about your GPU driver and the respective
> multi-screen setup ? I am sorry, I haven't really digged into this on Windows yet.
>
> The last multi screen test was a few years ago and it worked in big screen mode (duh!) :),
> since I could find the option to have them in separate screens.
>
> >
> > i will try to embedd a NEWTCanvasAWT inside a JFrame. hopefully this will
> > work.... :(
>
> Don't worry we will fix this together - your help (test/input) is very welcome.
Interesting, I was digging to my code and refreshing my memories about this issue
and it looks like Windows:
- Is always using 'big desktop' mode
- I validated this w/ VirtualBox (2 Screen)
-
http://stackoverflow.com/questions/1834771/how-do-you-get-createwindowex-to-create-the-window-on-a-specific-monitor- And your experience above ..
So the 'only' bug is that NEWT doesn't allow to set
a negative x/y position at creation and setPosition(..).
Works:
- Primary 'left' works, since secondary 'right' uses positive coordinates.
- Same would work for other monitors 'below' the primary.
Buggy:
- Primary on the 'right', since secondary 'left' uses negative coordinates.
- Same bug w/ other monitors 'above' the primary.
Currently the negative position or is used as a flag of 'no custom positioning'
in general (X11, Windows, ..), which shall signal the native windowing system
to auto position the window.
To allow a negative position, hence treat the big-desktop multi monitor mode right,
we need to review the code in this regard and add a flag for 'no custom positioning',
ie. auto-positioning. I guess we can do this.
Would allowing these positions be enough, ie satisfying ?
IMHO even w/ allowing other monitors to be in the negative coordinate space,
you just don't know when you launch your application.
So if you have a use case, where you like to drop one window on each monitor,
we might need more information ?!
I will check what we actually gather from the 'EnumDisplaySettingsEx'
in our ScreenMode queries from each monitor (Screen).
Since each Window is associated with a Screen (NEWT),
we can use this information for correct positioning.
But however we solve this issue, the monitor layout is variable
and we simply cannot now which one is left or right with the current data we have.
Note: I couldn't switch the position / role of display 1 and 2 at all in VirtualBox
so the primary becomes the 'right' display.
I guess I have to attach a real 2nd monitor to a real machine to test this later on.
Or is this now the default for windows 7 ?
>
> ~Sven
>
>