Hello Guest

[RFE] Enable maximize-window together with Display.setResizable

  • 24 Replies
  • 24870 Views
*

Offline NateS

  • **
  • 91
    • Esoteric Software
Re: [FIXED] Enable maximize-window together with Display.setResizable
« Reply #15 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:
Code: [Select]
Display.setLocation(Display.getX(), Display.getY());

*

Offline kappa

  • *****
  • 1314
Re: [FIXED] Enable maximize-window together with Display.setResizable
« Reply #16 on: August 09, 2012, 14:14:59 »
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.

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:
Code: [Select]
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 :)
« Last Edit: August 09, 2012, 14:19:19 by kappa »

*

Offline kappa

  • *****
  • 1314
Re: [RFE] Enable maximize-window together with Display.setResizable
« Reply #17 on: August 09, 2012, 14:29:06 »
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:

Code: [Select]
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).

Code: [Select]
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
}
« Last Edit: August 09, 2012, 14:43:05 by kappa »

*

Offline princec

  • *****
  • 1931
    • Puppygames
Re: [RFE] Enable maximize-window together with Display.setResizable
« Reply #18 on: August 09, 2012, 15:51:01 »
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 :)

*

Offline Matzon

  • *****
  • 2242
Re: [FIXED] Enable maximize-window together with Display.setResizable
« Reply #19 on: August 09, 2012, 21:48:35 »
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:
Code: [Select]
Display.setLocation(Display.getX(), Display.getY());

Works for me ... http://lwjgl.org/forum/index.php/topic,4673.msg25071/topicseen.html#new

*

Offline NateS

  • **
  • 91
    • Esoteric Software
Re: [FIXED] Enable maximize-window together with Display.setResizable
« Reply #20 on: August 11, 2012, 19:26:58 »
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, Linux is here (look for the setState method). Not sure that is helpful, as I haven't dug into how LWJGL creates the window.

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:
Code: [Select]
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.


Re: [RFE] Enable maximize-window together with Display.setResizable
« Reply #21 on: September 01, 2012, 19:47:19 »
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

*

Offline princec

  • *****
  • 1931
    • Puppygames
Re: [RFE] Enable maximize-window together with Display.setResizable
« Reply #22 on: September 02, 2012, 08:46:13 »
Why not use an AWT Frame with Display.setParent() in the meantime?

Cas :)

Re: [RFE] Enable maximize-window together with Display.setResizable
« Reply #23 on: September 02, 2012, 16:25:50 »
Indeed a viable workaround for the time being, just nudging that it would be great to have in LWJGL's API is all ;)

*

Offline NateS

  • **
  • 91
    • Esoteric Software
Re: [RFE] Enable maximize-window together with Display.setResizable
« Reply #24 on: September 04, 2012, 13:45:14 »
Aye, I've decided to go with a JFrame so this is no longer an issue for me.