internal/glfwwin: skip some functions for Xbox

Updates #2084
This commit is contained in:
Hajime Hoshi 2022-06-01 00:35:37 +09:00
parent aa4a2b64e0
commit 6fc71e97bb

View File

@ -301,6 +301,10 @@ func (w *Window) enableCursor() error {
}
func (w *Window) cursorInContentArea() (bool, error) {
if microsoftgdk.IsXbox() {
return true, nil
}
pos, err := _GetCursorPos()
if err != nil {
return false, err
@ -1442,6 +1446,9 @@ func (w *Window) platformDestroyWindow() error {
}
func (w *Window) platformSetWindowTitle(title string) error {
if microsoftgdk.IsXbox() {
return nil
}
return _SetWindowTextW(w.win32.handle, title)
}
@ -1829,6 +1836,9 @@ func (w *Window) platformSetWindowMonitor(monitor *Monitor, xpos, ypos, width, h
}
func (w *Window) platformWindowFocused() bool {
if microsoftgdk.IsXbox() {
return true
}
return w.win32.handle == _GetActiveWindow()
}
@ -1981,6 +1991,14 @@ func platformPollEvents() error {
}
}
var handle windows.HWND
if microsoftgdk.IsXbox() {
// Assume that there is always exactly one active window.
handle = _glfw.windows[0].win32.handle
} else {
handle = _GetActiveWindow()
}
// HACK: Release modifier keys that the system did not emit KEYUP for
// NOTE: Shift keys on Windows tend to "stick" when both are pressed as
// no key up message is generated by the first key release
@ -1988,7 +2006,7 @@ func platformPollEvents() error {
// Other Win hotkeys are handled implicitly by _glfwInputWindowFocus
// because they change the input focus
// NOTE: The other half of this is in the WM_*KEY* handler in windowProc
if handle := _GetActiveWindow(); handle != 0 {
if handle != 0 {
if window := handleToWindow[handle]; window != nil {
keys := [...]struct {
VK int