From ffc9a0876a83945c3d5d1328166809c8545f7cd1 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 25 May 2022 00:34:46 +0900 Subject: [PATCH] internal/glfwwin: remove changing the foreground lock timeout See https://github.com/glfw/glfw/commit/58b48a3a00d9c2a5ca10cc23069a71d8773cc7a4 Updates #2084 --- internal/glfwwin/internal_windows.go | 1 - internal/glfwwin/win32init_windows.go | 17 ++--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/internal/glfwwin/internal_windows.go b/internal/glfwwin/internal_windows.go index c1fa4707b..6763e4a55 100644 --- a/internal/glfwwin/internal_windows.go +++ b/internal/glfwwin/internal_windows.go @@ -281,7 +281,6 @@ type library struct { win32 struct { helperWindowHandle windows.HWND deviceNotificationHandle _HDEVNOTIFY - foregroundLockTimeout uint32 acquiredMonitorCount int clipboardString string keycodes [512]Key diff --git a/internal/glfwwin/win32init_windows.go b/internal/glfwwin/win32init_windows.go index b6173aa4a..bb216e9dc 100644 --- a/internal/glfwwin/win32init_windows.go +++ b/internal/glfwwin/win32init_windows.go @@ -283,15 +283,8 @@ func isWindows10BuildOrGreaterWin32(build uint16) bool { } func platformInit() error { - // 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) - if err := _SystemParametersInfoW(_SPI_GETFOREGROUNDLOCKTIMEOUT, 0, uintptr(unsafe.Pointer(&_glfw.win32.foregroundLockTimeout)), 0); err != nil { - return err - } - if err := _SystemParametersInfoW(_SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, _SPIF_SENDCHANGE); err != nil { - return err - } + // Changing the foreground lock timeout was removed from the original code. + // See https://github.com/glfw/glfw/commit/58b48a3a00d9c2a5ca10cc23069a71d8773cc7a4 createKeyTables() updateKeyNamesWin32() @@ -338,12 +331,6 @@ func platformTerminate() error { return err } - // Restore previous foreground lock timeout system setting - if err := _SystemParametersInfoW(_SPI_SETFOREGROUNDLOCKTIMEOUT, 0, uintptr(_glfw.win32.foregroundLockTimeout), _SPIF_SENDCHANGE); err != nil && !errors.Is(err, windows.ERROR_ACCESS_DENIED) { - // Access-denied can happen on WSL. - return err - } - terminateWGL() return nil