Skip to content

Commit

Permalink
internal/glfwwin: remove the call of RemovePropW
Browse files Browse the repository at this point in the history
This is unnecessary, and doesn't work on Xbox.

Also DestroyWindow doesn't work on Xbox so skip this on Xbox.

Updates #2084
  • Loading branch information
hajimehoshi committed Jul 30, 2022
1 parent a0546fc commit 95fb437
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
17 changes: 0 additions & 17 deletions internal/glfwwin/api_windows.go
Expand Up @@ -821,7 +821,6 @@ var (
procRegisterRawInputDevices = user32.NewProc("RegisterRawInputDevices")
procReleaseCapture = user32.NewProc("ReleaseCapture")
procReleaseDC = user32.NewProc("ReleaseDC")
procRemovePropW = user32.NewProc("RemovePropW")
procScreenToClient = user32.NewProc("ScreenToClient")
procSendMessageW = user32.NewProc("SendMessageW")
procSetCapture = user32.NewProc("SetCapture")
Expand Down Expand Up @@ -1498,22 +1497,6 @@ func _ReleaseDC(hWnd windows.HWND, hDC _HDC) int32 {
return int32(r)
}

func _RemovePropW(hWnd windows.HWND, str string) windows.Handle {
var lpString *uint16
if str != "" {
var err error
lpString, err = windows.UTF16PtrFromString(str)
if err != nil {
panic("glfwwin: str must not include a NUL character")
}
}

r, _, _ := procRemovePropW.Call(uintptr(hWnd), uintptr(unsafe.Pointer(lpString)))
runtime.KeepAlive(lpString)

return windows.Handle(r)
}

func _RtlVerifyVersionInfo(versionInfo *_OSVERSIONINFOEXW, typeMask uint32, conditionMask uint64) int32 {
var r uintptr
if unsafe.Sizeof(uintptr(0)) == unsafe.Sizeof(uint64(0)) {
Expand Down
6 changes: 4 additions & 2 deletions internal/glfwwin/win32init_windows.go
Expand Up @@ -295,8 +295,10 @@ func platformTerminate() error {
}

if _glfw.win32.helperWindowHandle != 0 {
if err := _DestroyWindow(_glfw.win32.helperWindowHandle); err != nil {
return err
if !microsoftgdk.IsXbox() {
if err := _DestroyWindow(_glfw.win32.helperWindowHandle); err != nil {
return err
}
}
}

Expand Down
7 changes: 4 additions & 3 deletions internal/glfwwin/win32window_windows.go
Expand Up @@ -1428,9 +1428,10 @@ func (w *Window) platformDestroyWindow() error {
}

if w.win32.handle != 0 {
_RemovePropW(w.win32.handle, "GLFW")
if err := _DestroyWindow(w.win32.handle); err != nil {
return err
if !microsoftgdk.IsXbox() {
if err := _DestroyWindow(w.win32.handle); err != nil {
return err
}
}
delete(handleToWindow, w.win32.handle)
w.win32.handle = 0
Expand Down

0 comments on commit 95fb437

Please sign in to comment.