Revert "internal/glfwwin: ignore errors from DWM functions"

This reverts commit 9ad87c0153.

Reason: Specifying nil for reading ranges is not efficient
This commit is contained in:
Hajime Hoshi 2022-06-03 13:49:45 +09:00
parent 3b13158cc0
commit 991cec993c
2 changed files with 15 additions and 16 deletions

View File

@ -242,8 +242,9 @@ func swapBuffersWGL(window *Window) error {
// HACK: Use DwmFlush when desktop composition is enabled // HACK: Use DwmFlush when desktop composition is enabled
if enabled { if enabled {
for i := 0; i < window.context.wgl.interval; i++ { 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). if err := _DwmFlush(); err != nil {
_ = _DwmFlush() return err
}
} }
} }
} }
@ -268,10 +269,10 @@ func swapIntervalWGL(interval int) error {
enabled := _IsWindows8OrGreater() enabled := _IsWindows8OrGreater()
if !enabled { if !enabled {
e, err := _DwmIsCompositionEnabled() var err error
// Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). enabled, err = _DwmIsCompositionEnabled()
if err == nil { if err != nil {
enabled = e return err
} }
} }

View File

@ -368,8 +368,7 @@ func (w *Window) updateFramebufferTransparency() error {
composition, err := _DwmIsCompositionEnabled() composition, err := _DwmIsCompositionEnabled()
if err != nil { if err != nil {
// Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). return err
return nil
} }
if !composition { if !composition {
return nil return nil
@ -379,8 +378,7 @@ func (w *Window) updateFramebufferTransparency() error {
if !_IsWindows8OrGreater() { if !_IsWindows8OrGreater() {
_, opaque, err = _DwmGetColorizationColor() _, opaque, err = _DwmGetColorizationColor()
if err != nil { if err != nil {
// Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). return err
return nil
} }
} }
@ -396,9 +394,9 @@ func (w *Window) updateFramebufferTransparency() error {
hRgnBlur: region, hRgnBlur: region,
fEnable: 1, // true fEnable: 1, // true
} }
if err := _DwmEnableBlurBehindWindow(w.win32.handle, &bb); err != nil {
// Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). return err
_ = _DwmEnableBlurBehindWindow(w.win32.handle, &bb) }
} else { } else {
// HACK: Disable framebuffer transparency on Windows 7 when the // HACK: Disable framebuffer transparency on Windows 7 when the
// colorization color is opaque, because otherwise the window // colorization color is opaque, because otherwise the window
@ -407,9 +405,9 @@ func (w *Window) updateFramebufferTransparency() error {
bb := _DWM_BLURBEHIND{ bb := _DWM_BLURBEHIND{
dwFlags: _DWM_BB_ENABLE, dwFlags: _DWM_BB_ENABLE,
} }
if err := _DwmEnableBlurBehindWindow(w.win32.handle, &bb); err != nil {
// Ignore an error from DWM functions as they might not be implemented e.g. on Proton (#2113). return err
_ = _DwmEnableBlurBehindWindow(w.win32.handle, &bb) }
} }
return nil return nil
} }