mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/ui: bug fix: care the case when CoInitializeEx returns S_FALSE
This commit is contained in:
parent
8ab220df7f
commit
72dc730b42
@ -20,6 +20,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
|
|
||||||
@ -187,9 +188,11 @@ func initializeWindowAfterCreation(w *glfw.Window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterfaceImpl) skipTaskbar() error {
|
func (u *userInterfaceImpl) skipTaskbar() error {
|
||||||
if err := windows.CoInitializeEx(0, windows.COINIT_MULTITHREADED); err != nil {
|
// S_FALSE is returned when CoInitializeEx is nested. This is a successful case.
|
||||||
|
if err := windows.CoInitializeEx(0, windows.COINIT_MULTITHREADED); err != nil && !errors.Is(err, syscall.Errno(windows.S_FALSE)) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// CoUninitialize should be called even when CoInitializeEx returns S_FALSE.
|
||||||
defer windows.CoUninitialize()
|
defer windows.CoUninitialize()
|
||||||
|
|
||||||
ptr, err := _CoCreateInstance(&_CLSID_TaskbarList, nil, _CLSCTX_SERVER, &_IID_ITaskbarList)
|
ptr, err := _CoCreateInstance(&_CLSID_TaskbarList, nil, _CLSCTX_SERVER, &_IID_ITaskbarList)
|
||||||
|
Loading…
Reference in New Issue
Block a user