Whats the best way to set the window size using newt so everything fits on screen properly even if a task bar is displayed?
Would like to able to allow user to select alternate screen sizes also. This is what my window code looks like right now: windowHeight = 1024; windowWidth = 1280; glp = GLProfile.get(GLProfile.GL2); caps = new GLCapabilities(glp); window = GLWindow.create(caps); window.setUndecorated(false); window.setSize(100,100); window.setVisible(true); // Set proper size windowHeight -= window.getInsets().getTotalHeight(); windowWidth -= window.getInsets().getTotalWidth(); window.setSize(windowWidth, windowHeight); window.setTopLevelPosition(window.getScreen().getWidth()/2-windowWidth/2, 0); window.requestFocus(); Thanks! |
Administrator
|
In reply to this post by zeeawk
I think this is what you need:
.setUndecorated(false); .setFullscreen(true); This maxes out the window without hiding the task bar. In Microsoft Windows at least. |
In reply to this post by gouessej
Unfortunately that doesn't really solve my problem. I need to know how big I can set the window while not going past the task bar. For instance my resolution is 1920x1080 right now. If I set screen size to that, the bottom of the window is under the task bar whether I use setTopLevelSize or setSize. What I think I need is something that takes requested screen size (ie 1920x1080), checks to see if the task bar is visible and if so subtracts the height of the task bar from the requested height then sets size. |
In reply to this post by Pixelapp
That makes the window full screen and hides the task bar. So unfortunately that doesn't work. |
Administrator
|
In reply to this post by Pixelapp
This is not the expected behavior, it should allow the NEWT window to be drawn above the task bar. If the task bar is still visible, it is a bug. I tested my game under Windows several weeks ago and the task bar was not displayed above the NEWT window. zeeawk, getInsets() returns the size of the window decoration, this is not what you want. Actually, there is not yet any way of getting the size of the task bar if any.
Julien Gouesse | Personal blog | Website
|
Administrator
|
This post was updated on .
In reply to this post by zeeawk
Please use that to get the height of the task bar until we have a NEWT equivalent:
final int taskBarHeight=SystemTray.getSystemTray().getTrayIconSize().getHeight();
Julien Gouesse | Personal blog | Website
|
Sorry for the late reply. Unfortunately that doesn't work quite right.
SystemTray.getSystemTray().getTrayIconSize.getHeight() returns the size of the icons in the System Tray. The height (at least on my machine) of System tray icons is 16 which is not the right size of the Task bar which is 40 (on my machine). Having a newt method to return the size of that task bar would be ideal or perhaps a newt equivalent to this: java.awt.Rectangle windowSize = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); final int taskBarHeight = screenSize.height - windowSize.height; |
Administrator
|
On 08/19/2012 08:51 PM, zeeawk [via jogamp] wrote:
> Sorry for the late reply. Unfortunately that doesn't work quite right. > > SystemTray.getSystemTray().getTrayIconSize.getHeight() returns the size of the > icons in the System Tray. > > The height (at least on my machine) of System tray icons is 16 which is not > the right size of the Task bar which is 40 (on my machine). > > Having a newt method to return the size of that task bar would be ideal or > perhaps a newt equivalent to this: > > java.awt.Rectangle windowSize = > java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); > > java.awt.Dimension screenSize = > java.awt.Toolkit.getDefaultToolkit().getScreenSize(); > final int taskBarHeight = screenSize.height - windowSize.height; lets discuss the following 2 approaches: EITHER .. +++ Dimension size = xxx.getMaximumWindowSize(); or Rectangle bounds = xxx.getMaximumWindowBounds() where xxx could be the NEWT screen or similar, however .. implementation querying the windowmanager for this information. If anybody here know the implementation of this for: X11, Windows, OSX, .. pls send reference and/or code snippets. +++ OR .. +++ BTW .. this is similar to another RFE window.setMaximize(boolean) boolean window.isMaximized() +++ The latter IMHO would be cheaper to implement. Maybe both are required .. dunno. ~Sven signature.asc (910 bytes) Download Attachment |
Administrator
|
It would be less ambiguous to have a method returning the size of the system tray. Maybe this could be helpful for the implementation under GNU Linux:
http://standards.freedesktop.org/systemtray-spec/systemtray-spec-latest.html
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |