wx command for preventing screensaver? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
TriKri
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Feb 24, 2011 1:46 am

wx command for preventing screensaver?

Post by TriKri » Sun Jul 03, 2011 1:11 pm

Hi, I'm looking for a way to prevent the screensaver from kicking in, and preferably also to prevent the screen from dimming on a laptop. I have looked around a bit on the forum, but I can't seem to find any platform independent way to do it, which I think would be perfect if there was. I think there should be some platform independent way to do this in wxWidgets, so my question is, is there? And if there isn't, why isn't there and is it planned to be implemented in the future?

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: wx command for preventing screensaver?

Post by Auria » Sun Jul 03, 2011 2:05 pm

A way that is very hackish, but gets the job done, is to fire a wxTimer and, say, once a minute, use wxWindow::WarpPointer (int x, int y) to move the mouse by one pixel ;)

A cleaner way is to catch power events ( http://docs.wxwidgets.org/trunk/classwx ... event.html ) and veto them, but that may not work on all systems
"Keyboard not detected. Press F1 to continue"
-- Windows

TriKri
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Feb 24, 2011 1:46 am

Re: wx command for preventing screensaver?

Post by TriKri » Sun Jul 10, 2011 12:42 pm

Thanks, I will consider that.
Auria wrote:A cleaner way is to catch power events ( http://docs.wxwidgets.org/trunk/classwx ... event.html ) and veto them, but that may not work on all systems
On the other hand, wxWindow::WarpPointer "is not supported under Mac because Apple Human Interface Guidelines forbid moving the mouse cursor programmatically", so I guess that none of the ways are perfect.

Post Reply