diff --git a/internal/graphicsdriver/directx/api_windows.go b/internal/graphicsdriver/directx/api_windows.go index 93520eba6..ab2bdb8cc 100644 --- a/internal/graphicsdriver/directx/api_windows.go +++ b/internal/graphicsdriver/directx/api_windows.go @@ -2072,6 +2072,10 @@ func (i *iDXGISwapChain4) GetCurrentBackBufferIndex() uint32 { func (i *iDXGISwapChain4) Present(syncInterval uint32, flags uint32) error { r, _, _ := syscall.Syscall(i.vtbl.Present, 3, uintptr(unsafe.Pointer(i)), uintptr(syncInterval), uintptr(flags)) if windows.Handle(r) != windows.S_OK { + // During a screen lock, Present fails (#2179). + if windows.Handle(r) == windows.DXGI_STATUS_OCCLUDED { + return nil + } return fmt.Errorf("directx: IDXGISwapChain4::Present failed: %w", windows.Errno(r)) } return nil diff --git a/internal/ui/ui_glfw_windows.go b/internal/ui/ui_glfw_windows.go index ed951d25a..9eaeef561 100644 --- a/internal/ui/ui_glfw_windows.go +++ b/internal/ui/ui_glfw_windows.go @@ -18,6 +18,7 @@ package ui import ( + "errors" "fmt" "runtime" "unsafe" @@ -169,7 +170,7 @@ func (u *userInterfaceImpl) adjustWindowPosition(x, y int, monitor *glfw.Monitor func initialMonitorByOS() (*glfw.Monitor, error) { px, py, err := getCursorPos() - if err != nil { + if err != nil && !errors.Is(err, windows.ERROR_ACCESS_DENIED) { return nil, err } x, y := int(px), int(py)