Getting the usable screen dimension

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Getting the usable screen dimension

Post 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.
Last edited by raidho36 on Sun Oct 09, 2016 6:54 am, edited 1 time in total.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Getting the usable screen dimension

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Getting the usable screen dimension

Post 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.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Getting the usable screen dimension

Post 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. :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Getting the usable screen dimension

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
pgimeno
Party member
Posts: 3641
Joined: Sun Oct 18, 2015 2:58 pm

Re: Getting the usable screen dimension

Post 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
Last edited by pgimeno on Sun Oct 09, 2016 10:51 pm, edited 1 time in total.
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Getting the usable screen dimension

Post 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.
VectorNormal
Prole
Posts: 8
Joined: Sun Oct 02, 2016 5:58 am

Re: Getting the usable screen dimension

Post 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!
User avatar
pgimeno
Party member
Posts: 3641
Joined: Sun Oct 18, 2015 2:58 pm

Re: Getting the usable screen dimension

Post by pgimeno »

Looks like in the next version that problem won't happen :) https://bitbucket.org/rude/love/issues/ ... rt-changed

Thanks, slime.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests