internal/glfw: apply go-fix for Windows

This commit is contained in:
Hajime Hoshi
2026-04-20 22:59:17 +09:00
parent f5688eb3e2
commit e157c9f5f9
3 changed files with 4 additions and 8 deletions
+2 -6
View File
@@ -8,6 +8,7 @@ package glfw
import (
"errors"
"fmt"
"slices"
"strings"
"unsafe"
@@ -331,12 +332,7 @@ func extensionSupportedWGL(extension string) bool {
return false
}
for _, str := range strings.Split(extensions, " ") {
if extension == str {
return true
}
}
return false
return slices.Contains(strings.Split(extensions, " "), extension)
}
func getProcAddressWGL(procname string) uintptr {
+1 -1
View File
@@ -145,7 +145,7 @@ func createKeyTables() {
_glfw.platformWindow.keycodes[0x037] = KeyKPMultiply
_glfw.platformWindow.keycodes[0x04A] = KeyKPSubtract
for scancode := 0; scancode < 512; scancode++ {
for scancode := range 512 {
if _glfw.platformWindow.keycodes[scancode] > 0 {
_glfw.platformWindow.scancodes[_glfw.platformWindow.keycodes[scancode]] = scancode
}
+1 -1
View File
@@ -2366,7 +2366,7 @@ func (c *Cursor) platformCreateCursor(img *image.NRGBA, xhot, yhot int) error {
// Repack into a tight RGBA buffer: createIcon expects contiguous pixels
// and a non-zero image origin or non-trivial stride would confuse it.
pixels := make([]byte, w*h*4)
for y := 0; y < h; y++ {
for y := range h {
src := img.PixOffset(b.Min.X, b.Min.Y+y)
copy(pixels[y*w*4:(y+1)*w*4], img.Pix[src:src+w*4])
}