Page 2 of 2
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 6:52 am
by raidho36
zorg wrote:
Worth noting that the love.resize callback won't be called if maximize succeeds
Doesn't that mean that there's no way to tell if window dimensions have actually changed without constantly polling for them, by extension making love.resize completely pointless since it doesn't detect window resize? This gotta be a bug.
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 6:54 am
by Positive07
I'm (or was at least) pretty sure that [wiki]love.window.maximize[/wiki] calls [wiki]love.resize[/wiki] if it succeeds. Since it resizes the window to it's maximized state, it is basically pressing the "maximize" button programmatically, which does trigger love.resize.
What doesn't call love.resize is a successful [wiki]love.window.setMode[/wiki] which is entirely different from love.window.maximize
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 6:58 am
by raidho36
I see that event doesn't trigger if programmatical resize succeeds since you already would know proper dimensions, but I really think that it should trigger anyway - to execute code related to window resizing.
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 7:06 am
by zorg
Positive07 wrote:I'm (or was at least) pretty sure that [wiki]love.window.maximize[/wiki] calls [wiki]love.resize[/wiki] if it succeeds. Since it resizes the window to it's maximized state, it is basically pressing the "maximize" button programmatically, which does trigger love.resize.
What doesn't call love.resize is a successful [wiki]love.window.setMode[/wiki] which is entirely different from love.window.maximize
Okay, my bad, though imo the wiki wording could be a bit more straightforward.
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 7:50 am
by Positive07
Well it says
LÖVE Wiki wrote:
Calls to love.window.setMode will only trigger this event if the width or height of the window after the call doesn't match the requested width and height...
So yeah I don't think that includes love.window.maximize which
LÖVE Wiki wrote:
...it essentially programmatically presses the window's "maximize" button.
I don't think the wording is wrong or something
Anyway I didn't understand what VectorNormal meant with
VectorNormal wrote:
when in windowed mode if you maximize the screen, the reported size of the window does not change. This is because resizing and maximizing are completely separate concepts
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 5:07 pm
by pgimeno
I think that VectorNormal's complaint is that love.graphics.getDimensions() doesn't return the new size immediately after calling love.window.maximize. However, note that it does in love.resize:
Code: Select all
function love.load()
print("Before:", love.graphics.getDimensions())
love.window.maximize()
print("After:", love.graphics.getDimensions())
end
function love.resize(w, h)
print("love.resize:", w, h, love.graphics.getDimensions())
end
This prints in my case:
Code: Select all
Before: 800 600
After: 800 600
love.resize: 1278 992 1278 992
(with an appropriate conf.lua that includes setting c.window.resizable = true)
Edit: Posted to the issue tracker as requested below:
https://bitbucket.org/rude/love/issues/ ... rt-changed
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 8:07 pm
by slime
pgimeno wrote:I think that VectorNormal's complaint is that love.graphics.getDimensions() doesn't return the new size immediately after calling love.window.maximize.
Can you make a post on the issue tracker about that? So I don't forget.
Re: Getting the usable screen dimension
Posted: Sun Oct 09, 2016 8:17 pm
by VectorNormal
Thank you very much Pgimeno! There was a point where I was certain I'd tried this and love.resize() never got called. Maybe I've been working too hard. I'll have to fiddle around a little bit more to see if I can figure out the other order of events that fail to trigger it. But you got it and it's working in my display/window managers (light DM and LXDM) wooo!
Lots of really great info in this thread, thanks everyone!
Re: Getting the usable screen dimension
Posted: Mon Oct 10, 2016 3:22 pm
by pgimeno
Looks like in the next version that problem won't happen
https://bitbucket.org/rude/love/issues/ ... rt-changed
Thanks, slime.