@@ -231,9 +231,6 @@ class StickyKeyFilter
231231 StickyKeyFilter ()
232232 {
233233 screensaverState = false ;
234- SystemParametersInfo (SPI_GETSCREENSAVEACTIVE, 0 , &screensaverState, 0 );
235- if (screensaverState)
236- SystemParametersInfo (SPI_SETSCREENSAVEACTIVE, FALSE , nullptr , 0 );
237234 stickyKeysFlags = 0 ;
238235 filterKeysFlags = 0 ;
239236 toggleKeysFlags = 0 ;
@@ -243,6 +240,15 @@ class StickyKeyFilter
243240 stickyKeys.cbSize = sizeof (stickyKeys);
244241 filterKeys.cbSize = sizeof (filterKeys);
245242 toggleKeys.cbSize = sizeof (toggleKeys);
243+ }
244+
245+ void initialize ()
246+ {
247+ SystemParametersInfo (SPI_GETSCREENSAVEACTIVE, 0 , &screensaverState, 0 );
248+
249+ if (screensaverState)
250+ SystemParametersInfo (SPI_SETSCREENSAVEACTIVE, FALSE , nullptr , 0 );
251+
246252 SystemParametersInfo (SPI_GETSTICKYKEYS, sizeof (stickyKeys), &stickyKeys, 0 );
247253 SystemParametersInfo (SPI_GETFILTERKEYS, sizeof (filterKeys), &filterKeys, 0 );
248254 SystemParametersInfo (SPI_GETTOGGLEKEYS, sizeof (toggleKeys), &toggleKeys, 0 );
@@ -344,12 +350,10 @@ int RunApplication(pcstr commandLine)
344350 xr_strcpy (Core.UserName , sizeof (Core.UserName ), " Player" );
345351 xr_strcpy (Core.CompName , sizeof (Core.CompName ), " Computer" );
346352 }
347-
353+
354+ StickyKeyFilter filter;
348355 if (GEnv.isDedicatedServer )
349- {
350- StickyKeyFilter filter;
351- UNUSED (filter);
352- }
356+ filter.initialize ();
353357
354358 FPU::m24r ();
355359 InitEngine ();
0 commit comments