Re: Wrong size when switching to windowed mode
Posted by
Sven Gothel on
Nov 10, 2012; 3:54pm
URL: https://forum.jogamp.org/Wrong-size-when-switching-to-windowed-mode-tp4026835p4026849.html
On 11/10/2012 11:38 AM, gouessej [via jogamp] wrote:
> Hi
>
> I solved my problem that way:
> final GLWindow glWindow=joglNewtWindow.getNewtWindow();
> final boolean fullscreenOn=glWindow.isFullscreen();
> final int screenWidth=glWindow.getScreen().getWidth();
> final int screenHeight=glWindow.getScreen().getHeight();
> glWindow.setFullscreen(!fullscreenOn);
> glWindow.setUndecorated(!fullscreenOn);
> glWindow.setTopLevelSize(screenWidth,screenHeight);
> glWindow.setTopLevelPosition(0,0);
> glWindow.invoke(false, new GLRunnable() {
>
> @Override
> public boolean run(GLAutoDrawable glAutoDrawable) {
> glWindow.setTopLevelSize(screenWidth,screenHeight);
> return true;
> }
> });
>
> I was right, the switch to windowed mode tries to reset the latest size of the
> window in this mode which is close to 100 * 100 when you just create a
> GLWindow that you immediately puts into full screen mode. I assume it is
> intentional and not a bug. Invoking setTopLevelSize a bit later seems to work.
So setting size on the next GL display is deferred, i.e.
after leaving fullscreen mode and reset back to default size
which is actually 128 x 128.
How about setting the default size before setVisible(true) ?
It won't affect your desired fullscreen mode,
but define the size when you leave fullscreen.
If that doesn't work, it's a bug
and we should copy one of the ScreenMode unit tests for this purpose.
The latter already test combination of this - maybe not your case exactly.
~Sven