Skip to content

Commit

Permalink
Fix potential issues with StickyKeyFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jan 9, 2018
1 parent 0263fa4 commit 71181ab
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/xrEngine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@ class StickyKeyFilter
StickyKeyFilter()
{
screensaverState = false;
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &screensaverState, 0);
if (screensaverState)
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, nullptr, 0);
stickyKeysFlags = 0;
filterKeysFlags = 0;
toggleKeysFlags = 0;
Expand All @@ -243,6 +240,15 @@ class StickyKeyFilter
stickyKeys.cbSize = sizeof(stickyKeys);
filterKeys.cbSize = sizeof(filterKeys);
toggleKeys.cbSize = sizeof(toggleKeys);
}

void initialize()
{
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &screensaverState, 0);

if (screensaverState)
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, nullptr, 0);

SystemParametersInfo(SPI_GETSTICKYKEYS, sizeof(stickyKeys), &stickyKeys, 0);
SystemParametersInfo(SPI_GETFILTERKEYS, sizeof(filterKeys), &filterKeys, 0);
SystemParametersInfo(SPI_GETTOGGLEKEYS, sizeof(toggleKeys), &toggleKeys, 0);
Expand Down Expand Up @@ -344,12 +350,10 @@ int RunApplication(pcstr commandLine)
xr_strcpy(Core.UserName, sizeof(Core.UserName), "Player");
xr_strcpy(Core.CompName, sizeof(Core.CompName), "Computer");
}


StickyKeyFilter filter;
if (GEnv.isDedicatedServer)
{
StickyKeyFilter filter;
UNUSED(filter);
}
filter.initialize();

FPU::m24r();
InitEngine();
Expand Down

0 comments on commit 71181ab

Please sign in to comment.