Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.0 Disable Screensaver  (Read 3969 times)

0 Members and 1 Guest are viewing this topic.

MonkeyKnight

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
SFML 2.0 Disable Screensaver
« on: April 17, 2012, 01:41:34 am »
How would one disable the screensaver?

I have looked through the docs, but can't seem to find it.


Thanks.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Re: SFML 2.0 Disable Screensaver
« Reply #1 on: April 17, 2012, 02:08:27 am »
This is completely irrelevant to SFML. Programs can not turn off the screensaver. Only the user can through changing their options in the OS.
I use the latest build of SFML2

Deftwun

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML 2.0 Disable Screensaver
« Reply #2 on: April 17, 2012, 02:50:49 am »
You cant disable it with SFML like OniLinkPlus said but maybe you could use sf::mouse::SetPosition() every few seconds.just move it by like a pixel from its current position or something so it doesn't look weird. Not 100% sure if it would work and pretty hacky but if you plan on just having the program run without user input for an extended period of time it might not be a big deal

MonkeyKnight

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
Re: SFML 2.0 Disable Screensaver
« Reply #3 on: April 17, 2012, 03:04:23 am »
This is completely irrelevant to SFML.

Perhaps this is a bit harsh. In SDL2 I would call
Code: [Select]
SDL_DisableScreenSaver();. I was merely looking for an equivalent to this in SFML.

Perhaps it is completely not possible in SFML, but to say completely irrelevant?

I am trying to use SFML2 in place of SDL2 in our kiosk systems. So, my next task is going to be to disable the mouse - so I am not sure that will work as planned either.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 2.0 Disable Screensaver
« Reply #4 on: April 17, 2012, 11:06:25 am »
Which OS are you targeting?

You'll probably need to use OS dependant API in order to achieve this. I don't know what is provided for this on Windows but on Mac OS X there are functions to prevent the OS from sleeping. Actually they are designed for usecases such as yours.
Want to play movies in your SFML application? Check out sfeMovie!

MonkeyKnight

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
Re: SFML 2.0 Disable Screensaver
« Reply #5 on: April 17, 2012, 08:00:25 pm »
Targeting Linux. Multiple distros. I develop mainly on OS X, deploy test runs on Linux, usually Ubuntu or Debian.

I will have to look through the SDL code to see what they are doing, and perhaps add that to SFML if time permits.

Thanks for your help!

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML 2.0 Disable Screensaver
« Reply #6 on: April 17, 2012, 09:18:01 pm »
Windows: SetThreadExecutionState()
Linux: XResetScreenSaver()
Mac OS X: UpdateSystemActivity()
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

MonkeyKnight

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
Re: SFML 2.0 Disable Screensaver
« Reply #7 on: April 17, 2012, 09:52:27 pm »
Excellent. Thank you very much!

 

anything