浏览代码

Win32: Remove changing the foreground lock timeout

It's rude to ignore the foreground lock timeout, especially by default.

Discussion of this code and its removal:
https://discourse.glfw.org/t/why-is-spi-setforegroundlocktimeout-set-to-zero-on-glfwinit-win32
Camilla Löwy 4 年之前
父节点
当前提交
58b48a3a00
共有 3 个文件被更改,包括 1 次插入14 次删除
  1. 1 0
      README.md
  2. 0 13
      src/win32_init.c
  3. 0 1
      src/win32_platform.h

+ 1 - 0
README.md

@@ -172,6 +172,7 @@ information on what to include when reporting a bug.
  - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
  - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
    later (#1783,#1796)
    later (#1783,#1796)
  - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
  - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
+ - [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user
  - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
  - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
  - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
  - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
  - [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
  - [Cocoa] Moved main menu creation to GLFW initialization time (#1649)

+ 0 - 13
src/win32_init.c

@@ -558,14 +558,6 @@ BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build)
 
 
 int _glfwPlatformInit(void)
 int _glfwPlatformInit(void)
 {
 {
-    // To make SetForegroundWindow work as we want, we need to fiddle
-    // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
-    // as possible in the hope of still being the foreground process)
-    SystemParametersInfoW(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
-                          &_glfw.win32.foregroundLockTimeout, 0);
-    SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
-                          SPIF_SENDCHANGE);
-
     if (!loadLibraries())
     if (!loadLibraries())
         return GLFW_FALSE;
         return GLFW_FALSE;
 
 
@@ -601,11 +593,6 @@ void _glfwPlatformTerminate(void)
 
 
     _glfwUnregisterWindowClassWin32();
     _glfwUnregisterWindowClassWin32();
 
 
-    // Restore previous foreground lock timeout system setting
-    SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
-                          UIntToPtr(_glfw.win32.foregroundLockTimeout),
-                          SPIF_SENDCHANGE);
-
     free(_glfw.win32.clipboardString);
     free(_glfw.win32.clipboardString);
     free(_glfw.win32.rawInput);
     free(_glfw.win32.rawInput);
 
 

+ 0 - 1
src/win32_platform.h

@@ -330,7 +330,6 @@ typedef struct _GLFWlibraryWin32
 {
 {
     HWND                helperWindowHandle;
     HWND                helperWindowHandle;
     HDEVNOTIFY          deviceNotificationHandle;
     HDEVNOTIFY          deviceNotificationHandle;
-    DWORD               foregroundLockTimeout;
     int                 acquiredMonitorCount;
     int                 acquiredMonitorCount;
     char*               clipboardString;
     char*               clipboardString;
     short int           keycodes[512];
     short int           keycodes[512];