Blitzmax apps prevent screensaver running

BlitzMax Forums/BlitzMax Programming/Blitzmax apps prevent screensaver running

GfK(Posted 2006) [#1]
Hello.

I discovered a serious problem in Blitzmax last night, and this morning while trying to figure out the cause, I stumbled upon something else fairly major too.

When a Blitzmax app is running, it seems that it is preventing the Windows screensaver from kicking in. Furthermore, it is also preventing my monitor from powering off after a period of non-use.

Anyone else confirm this?


Grey Alien(Posted 2006) [#2]
Are you using an event driven main loop (with time for OS to do stuff) or a tight main loop with no delay(1) in it? Were you running in full-screen or windowed mode? This might ot make a different but I thought it would be useful info.


GfK(Posted 2006) [#3]
Windowed/Fullscreen makes no difference.

Been doing a bit of playing.

Ran this code:
Graphics 800,600
While Not KeyDown(key_escape)
	Delay 1
Wend
Screensaver works as expected.

I've been commenting out bit of my own code trying to locate the problem - there's something in the Blitzmax commandset thats causing this; I'm not doing anything fancy.

I've thus far ruled out AppTerminate(), DrawText, Cls, FlushMouse, Flip and the mouse lag fix.


GfK(Posted 2006) [#4]
Found the problem.
SetGraphicsDriver GLMax2DDriver()

This can't be 'expected behaviour'??


skidracer(Posted 2006) [#5]
That code was added because GridWars players using joypads got sick of screen savers cutting in during heated battles.


ImaginaryHuman(Posted 2006) [#6]
I think it makes sense, why would you really likely want your screensaver to run while a blitzmax app is running ... unless it's an application perhaps.

A `prevent screensaver` command would be nice.


Damien Sturdy(Posted 2006) [#7]

unless it's an application perhaps.



Bingo!

Skid, What about a "DisableScreenSaver" command?


Grey Alien(Posted 2006) [#8]
flag is the way to go, default = off please.


N(Posted 2006) [#9]
I would also like a toggle for this.


FlameDuck(Posted 2006) [#10]
Stupid question time: Wouldn't it be better to let Windows handle this? I believe there's a "Disable screensaver in full-screen mode" option somewhere?


GfK(Posted 2006) [#11]
Stupid question time: Wouldn't it be better to let Windows handle this? I believe there's a "Disable screensaver in full-screen mode" option somewhere?
Not that I'm aware of. They could just turn off screensavers, though, and disable monitor powersaving, but all that's probably too much hassle for the end user.

But even so, what if someone's playing a game in Windowed mode?

It does need to be optional.


ImaginaryHuman(Posted 2006) [#12]
I don't know if it makes sense to allow the o/s to do the handling of switching it off. The user is assuming they are providing user-input and that therefore they are operating the display, and therefore the screensaver should not show up. They assume that even if they have their screensaver switched on and set up to show only when there is no activity from the user, that the fact they are activating things means the screensaver won't show, which they trust from the o/s. So it makes sense that using our app should *override* the screensaver activating, but not mess with the default settings that the user chose. If the screensaver is switched on in the o/s, let us choose whether to disable it. You shouldn't have to get the user to mess with system settings to make your app work right.


Gabriel(Posted 2006) [#13]
When the screensaver tries to start up, Windows sends out a WM_SYSCOMMAND Windows Message which is of type SC_SCREENSAVE ( windows constants ) and I would assume BlitzMax is returning 0, which tells the screensaver not to start. I do this in my TV3D wrapper too, but that's not going to be used for background applications.

I post this because I can't think of any way of intercepting it with the way BMax is written, but perhaps there is a way I haven't thought of.

But I agree, it should be a flag, even if it's enabled by default. BlitzMax is going to be used for things where you want a screensaver to start.


Yan(Posted 2006) [#14]
I've been using SystemParametersInfo() to turn off the screen and power saving features whilst the app is running.

Obviously no good when using GLMax2D though.