Hi everyone
It'd be nice if the window managed by LWJGL had a maximize button (WS_MAXIMIZEBOX style on Windows) when resizing is enabled.
I tested with Windows 7 (and 8 ).
Cheers,
Simon
I attached a diff to fix the behavior. This works at least on Windows XP, Vista, 7 and 8. I did not test any other platforms, but I made no changes there anyway. Hope you can use it!
aye, window looks easy enough to fix - dont know about mac / linux tho. Waiting for someone to chime in before applying.
Ok. It shouldn't break anything on other platforms and improve the situation on Windows. But having a similar fix for other platforms (if they even show the same behavior) would be desirable.
Anybody chiming in?
I have applied the patch for windows. kappaOne mentioned on IRC it should be easy enough to add on linux and mac (although he did mention that mac was "different" in that regard).
Cool, thanks!
I can confirm that the maximise button already works as expected on both Linux and Mac when Display.setResizable(true) is set. So no need to make further changes for those platforms.
RFE marked as complete and implemented.
What about the "restore" functionality? And is there any API to retrieve extended window state a la AWT?
Cas :)
Quote from: princec on January 22, 2012, 22:46:57
What about the "restore" functionality?
If you mean the restore button once maximised (to return window to size it was before maximising), then yeh that works fine, as expected.
Quote from: princec on January 22, 2012, 22:46:57
And is there any API to retrieve extended window state a la AWT?
Extended window state? you mean like an API to detect if the window is minimised, make it flash, etc? or something else?
Cool.
The extended state - eg query and set the iconified status of the window programmatically.
Cas :)
Quote from: princec on January 23, 2012, 22:15:22
The extended state - eg query and set the iconified status of the window programmatically.
Ah, as far as I'm aware there is no API currently to get the extended state of the Display window. The only API I'm aware of is Display.isActive() which will tell you if the window is focused or not (will also return false if window is minimised).
I'm necro'ing this topic (in case the OP or others interested in maximize enabled notify on this thread) to ask for a new feature: Can Display have a feature to maximize and restore (unmaximize) the window? I need to both query and set the current maximized state. I need this for a desktop app where I want to restore the application window to the same state it was in when the app was closed.
Edit: Seems to be a related problem, if I save Display.getX/Y and use the values with Display.getLocation when the app next runs, the window is not positioned in the same location. Eg:
Display.setLocation(822, 525);
Display.create(...);
System.out.println(Display.getX() + ", " + Display.getY()); // 832, 565
That is on Windows 7 Ultimate 64-bit. I can create a new thread for either or both issues if you prefer.
Quote from: NateS on August 01, 2012, 03:36:54
I'm necro'ing this topic (in case the OP or others interested in maximize enabled notify on this thread) to ask for a new feature: Can Display have a feature to maximize and restore (unmaximize) the window? I need to both query and set the current maximized state. I need this for a desktop app where I want to restore the application window to the same state it was in when the app was closed.
Not sure if there are cross platform issues with this ?
Quote
Edit: Seems to be a related problem, if I save Display.getX/Y and use the values with Display.getLocation when the app next runs, the window is not positioned in the same location. Eg:
Display.setLocation(822, 525);
Display.create(...);
System.out.println(Display.getX() + ", " + Display.getY()); // 832, 565
That is on Windows 7 Ultimate 64-bit. I can create a new thread for either or both issues if you prefer.
Try nightly.
Quote from: Matzon on August 01, 2012, 17:11:13
Quote from: NateS on August 01, 2012, 03:36:54
I'm necro'ing this topic (in case the OP or others interested in maximize enabled notify on this thread) to ask for a new feature: Can Display have a feature to maximize and restore (unmaximize) the window? I need to both query and set the current maximized state. I need this for a desktop app where I want to restore the application window to the same state it was in when the app was closed.
Not sure if there are cross platform issues with this ?
I'm not sure either. I do think support for it is important. I would be fine if it worked on Windows, if only until it could be implemented for other OSes. The bad part without this feature is that when the user maximizes the window, all I know is that is has been resized. When they launch the app again, they get a huge window that isn't maximized.
Quote
Quote
Edit: Seems to be a related problem, if I save Display.getX/Y and use the values with Display.getLocation when the app next runs, the window is not positioned in the same location. Eg:
Display.setLocation(822, 525);
Display.create(...);
System.out.println(Display.getX() + ", " + Display.getY()); // 832, 565
That is on Windows 7 Ultimate 64-bit. I can create a new thread for either or both issues if you prefer.
Try nightly.
Verified it works correctly in nightly build #1757. Thanks!
A related feature would be to know when the application is minimized. I don't want to stop rendering if the window is not active but still visible, but if it is minimized then I do want to stop rendering.
Actually I lied. The window seems to show up in different locations each time I run my app. To see the problem, put this in your render loop and enjoy:
Display.setLocation(Display.getX(), Display.getY());
Quote from: NateS on August 09, 2012, 13:13:18
I'm not sure either. I do think support for it is important. I would be fine if it worked on Windows, if only until it could be implemented for other OSes.
I think AWT allows you to query and set the iconified status of the window programmatically so should be possible to implement crossplatfrom. However not sure how much work it'll be since each platform will have to have its own implementation.
Quote from: NateS on August 09, 2012, 13:13:18
The bad part without this feature is that when the user maximizes the window, all I know is that is has been resized. When they launch the app again, they get a huge window that isn't maximized.
A proper API is preferable but in the mean time you could try a hack to guess if the window is maximised:
if ((Display.getX() == 0 || Display.getY() == 0) &&
(Display.getWidth() == Display.getDesktopDisplayMode().getWidth() ||
Display.getHeight() == Display.getDesktopDisplayMode().getHeight())) {
// window likely maximised
}
The above tries to take into account the various positions the taskbar could be but I might have missed other conditions that would cause the above not to detect a maximised window :)
hmm, thinking about that a little further that code would fail when using Windows's drag snap left or drag snap right feature. So the following would likely work better:
if ((Display.getX() == 0 && Display.getWidth() == Display.getDesktopDisplayMode().getWidth()) ||
(Display.getY() == 0 && Display.getHeight() == Display.getDesktopDisplayMode().getHeight())) {
// window likely maximised
}
or for a bit more robustness maybe add another check as below (provided the taskbar isn't larger than half the screen, could probably bump up the check to 2/3 the screen or more).
if ((Display.getX() == 0 && Display.getWidth() == Display.getDesktopDisplayMode().getWidth() &&
Display.getHeight() > Display.getDesktopDisplayMode().getHeight()/2) ||
(Display.getY() == 0 && Display.getDesktopDisplayMode().getHeight() &&
Display.getWidth() > Display.getDesktopDisplayMode().getWidth()/2)) {
// window likely maximised
}
Adding a simple API to get the iconification state of the window would do what you wanted. AWT has it so it's probably reasonably safe to assume it's cross-platform.
Cas :)
Quote from: NateS on August 09, 2012, 14:07:13
Actually I lied. The window seems to show up in different locations each time I run my app. To see the problem, put this in your render loop and enjoy:
Display.setLocation(Display.getX(), Display.getY());
Works for me ... http://lwjgl.org/forum/index.php/topic,4673.msg25071/topicseen.html#new
Thanks for the ideas kappa. I'll probably go with not saving the window size if it is a good percentage of the screen size. I still think it is an important ability to be able to query for isMinimized and isMaximized, as well as being able maximize the window (and maybe for completeness, being able to restore/unmaximize and minimize it).
Good point about AWT, Cas. It seems AWT uses Toolkit#isFrameStateSupported(int) to see if extended window flags are supported. States are normal, iconified (minimized), maximized horiz, maximized vert, and maximized both. Windows and Linux seem to support only normal, iconified, and maximized both. Not sure about Mac. Windows Harmony source is here (http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/awt/src/main/java/windows/org/apache/harmony/awt/wtk/windows/WinWindow.java?revision=929253&view=markup), Linux is here (http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindow.java?view=markup) (look for the setState method). Not sure that is helpful, as I haven't dug into how LWJGL creates the window.
Quote from: Matzon on August 09, 2012, 21:48:35
Quote from: NateS on August 09, 2012, 14:07:13
Actually I lied. The window seems to show up in different locations each time I run my app. To see the problem, put this in your render loop and enjoy:
Display.setLocation(Display.getX(), Display.getY());
Works for me ... http://lwjgl.org/forum/index.php/topic,4673.msg25071/topicseen.html#new
Aye, I got the nightlies again and verified it again. It does seem to work correctly. Sometimes I think I'm going nuts.
Hi there,
My request is apt for this thread but slightly different, could we please have the ability to maximize the window programatically as my application requires full screen real estate but is impractical without the start bar etc accessible. Setting the height and width to the screen resolution is messy and it would just be a lot tidier if I could start it maximized.
The first thing my users pointed out was 'why do i always have to maximize it?' so I think this is a fairly obvious feature to have.
I don't know what work would be involved in this but it would make me one happy chappy :)
Thanks for your time,
Liam
Why not use an AWT Frame with Display.setParent() in the meantime?
Cas :)
Indeed a viable workaround for the time being, just nudging that it would be great to have in LWJGL's API is all ;)
Aye, I've decided to go with a JFrame so this is no longer an issue for me.