From 991cec993c3429dc37cfdab12eaa9f7308d7e55a Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 3 Jun 2022 13:49:45 +0900 Subject: [PATCH] Revert "internal/glfwwin: ignore errors from DWM functions" This reverts commit 9ad87c0153b7815011e041fad688b0368d233cbb. Reason: Specifying nil for reading ranges is not efficient --- internal/glfwwin/wglcontext_windows.go | 13 +++++++------ internal/glfwwin/win32window_windows.go | 18 ++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/internal/glfwwin/wglcontext_windows.go b/internal/glfwwin/wglcontext_windows.go index f5a6bc33e..78fff324e 100644 --- a/internal/glfwwin/wglcontext_windows.go +++ b/internal/glfwwin/wglcontext_windows.go @@ -242,8 +242,9 @@ func swapBuffersWGL(window *Window) error { // HACK: Use DwmFlush when desktop composition is enabled if enabled { for i := 0; i < window.context.wgl.interval; i++ { - // Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). - _ = _DwmFlush() + if err := _DwmFlush(); err != nil { + return err + } } } } @@ -268,10 +269,10 @@ func swapIntervalWGL(interval int) error { enabled := _IsWindows8OrGreater() if !enabled { - e, err := _DwmIsCompositionEnabled() - // Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). - if err == nil { - enabled = e + var err error + enabled, err = _DwmIsCompositionEnabled() + if err != nil { + return err } } diff --git a/internal/glfwwin/win32window_windows.go b/internal/glfwwin/win32window_windows.go index 3d00d5711..e91e05671 100644 --- a/internal/glfwwin/win32window_windows.go +++ b/internal/glfwwin/win32window_windows.go @@ -368,8 +368,7 @@ func (w *Window) updateFramebufferTransparency() error { composition, err := _DwmIsCompositionEnabled() if err != nil { - // Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). - return nil + return err } if !composition { return nil @@ -379,8 +378,7 @@ func (w *Window) updateFramebufferTransparency() error { if !_IsWindows8OrGreater() { _, opaque, err = _DwmGetColorizationColor() if err != nil { - // Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). - return nil + return err } } @@ -396,9 +394,9 @@ func (w *Window) updateFramebufferTransparency() error { hRgnBlur: region, fEnable: 1, // true } - - // Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). - _ = _DwmEnableBlurBehindWindow(w.win32.handle, &bb) + if err := _DwmEnableBlurBehindWindow(w.win32.handle, &bb); err != nil { + return err + } } else { // HACK: Disable framebuffer transparency on Windows 7 when the // colorization color is opaque, because otherwise the window @@ -407,9 +405,9 @@ func (w *Window) updateFramebufferTransparency() error { bb := _DWM_BLURBEHIND{ dwFlags: _DWM_BB_ENABLE, } - - // Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). - _ = _DwmEnableBlurBehindWindow(w.win32.handle, &bb) + if err := _DwmEnableBlurBehindWindow(w.win32.handle, &bb); err != nil { + return err + } } return nil }