Skip to content

Commit b3d8b77

Browse files
committed
Fix automatic activation
1 parent e972a53 commit b3d8b77

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/stayawake.cpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ StayAwake::StayAwake(HWND hwnd) :
4646

4747
hwnd_(hwnd),
4848
timeout_([=](){ update(); }, -1)
49-
{ }
49+
{
50+
timeout_.setInterval(10 * 1000);
51+
}
5052

5153
StayAwake::~StayAwake()
5254
{
@@ -82,13 +84,10 @@ void StayAwake::updateTimer()
8284

8385
is_timer_active_ = state;
8486

85-
if (state)
86-
{
87-
timeout_.setInterval(30 * 1000);
88-
}
89-
else
90-
{
91-
timeout_.setInterval(-1);
87+
if (state) {
88+
timeout_.start();
89+
} else {
90+
timeout_.stop();
9291
}
9392
}
9493

0 commit comments

Comments
 (0)