From 35e25a36364e88b8dc99740f8735f61b17b41084 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 21 Jan 2023 22:09:12 +0900 Subject: [PATCH] rename internal/glfwwin -> internal/goglfw Updates #2546 --- internal/glfw/callback_windows.go | 14 +- internal/glfw/glfw_windows.go | 114 ++++++------ internal/glfw/native_windows.go | 4 +- internal/glfw/type_windows.go | 16 +- internal/{glfwwin => goglfw}/api_windows.go | 172 +++++++++--------- .../{glfwwin => goglfw}/context_windows.go | 48 ++--- .../{glfwwin => goglfw}/glfw3h_windows.go | 2 +- internal/{glfwwin => goglfw}/init_windows.go | 2 +- internal/{glfwwin => goglfw}/input_windows.go | 20 +- .../{glfwwin => goglfw}/internal_windows.go | 2 +- .../{glfwwin => goglfw}/monitor_windows.go | 2 +- .../{glfwwin => goglfw}/wglcontext_windows.go | 14 +- .../{glfwwin => goglfw}/win32init_windows.go | 2 +- .../win32monitor_windows.go | 18 +- .../win32platform_windows.go | 2 +- .../win32thread_windows.go | 8 +- .../win32window_windows.go | 12 +- .../{glfwwin => goglfw}/window_windows.go | 24 +-- 18 files changed, 238 insertions(+), 238 deletions(-) rename internal/{glfwwin => goglfw}/api_windows.go (92%) rename internal/{glfwwin => goglfw}/context_windows.go (85%) rename internal/{glfwwin => goglfw}/glfw3h_windows.go (99%) rename internal/{glfwwin => goglfw}/init_windows.go (98%) rename internal/{glfwwin => goglfw}/input_windows.go (92%) rename internal/{glfwwin => goglfw}/internal_windows.go (99%) rename internal/{glfwwin => goglfw}/monitor_windows.go (99%) rename internal/{glfwwin => goglfw}/wglcontext_windows.go (96%) rename internal/{glfwwin => goglfw}/win32init_windows.go (99%) rename internal/{glfwwin => goglfw}/win32monitor_windows.go (92%) rename internal/{glfwwin => goglfw}/win32platform_windows.go (98%) rename internal/{glfwwin => goglfw}/win32thread_windows.go (84%) rename internal/{glfwwin => goglfw}/win32window_windows.go (99%) rename internal/{glfwwin => goglfw}/window_windows.go (94%) diff --git a/internal/glfw/callback_windows.go b/internal/glfw/callback_windows.go index f54ed0c59..60c4f57fa 100644 --- a/internal/glfw/callback_windows.go +++ b/internal/glfw/callback_windows.go @@ -15,14 +15,14 @@ package glfw import ( - "github.com/hajimehoshi/ebiten/v2/internal/glfwwin" + "github.com/hajimehoshi/ebiten/v2/internal/goglfw" ) func ToCharModsCallback(cb func(window *Window, char rune, mods ModifierKey)) CharModsCallback { if cb == nil { return nil } - return func(window *glfwwin.Window, char rune, mods glfwwin.ModifierKey) { + return func(window *goglfw.Window, char rune, mods goglfw.ModifierKey) { cb((*Window)(window), char, ModifierKey(mods)) } } @@ -31,7 +31,7 @@ func ToCloseCallback(cb func(window *Window)) CloseCallback { if cb == nil { return nil } - return func(window *glfwwin.Window) { + return func(window *goglfw.Window) { cb((*Window)(window)) } } @@ -40,7 +40,7 @@ func ToFramebufferSizeCallback(cb func(window *Window, width int, height int)) F if cb == nil { return nil } - return func(window *glfwwin.Window, width int, height int) { + return func(window *goglfw.Window, width int, height int) { cb((*Window)(window), width, height) } } @@ -49,7 +49,7 @@ func ToMonitorCallback(cb func(monitor *Monitor, event PeripheralEvent)) Monitor if cb == nil { return nil } - return func(monitor *glfwwin.Monitor, event glfwwin.PeripheralEvent) { + return func(monitor *goglfw.Monitor, event goglfw.PeripheralEvent) { cb((*Monitor)(monitor), PeripheralEvent(event)) } } @@ -58,7 +58,7 @@ func ToScrollCallback(cb func(window *Window, xoff float64, yoff float64)) Scrol if cb == nil { return nil } - return func(window *glfwwin.Window, xoff float64, yoff float64) { + return func(window *goglfw.Window, xoff float64, yoff float64) { cb((*Window)(window), xoff, yoff) } } @@ -67,7 +67,7 @@ func ToSizeCallback(cb func(window *Window, width int, height int)) SizeCallback if cb == nil { return nil } - return func(window *glfwwin.Window, width int, height int) { + return func(window *goglfw.Window, width int, height int) { cb((*Window)(window), width, height) } } diff --git a/internal/glfw/glfw_windows.go b/internal/glfw/glfw_windows.go index 314c1c572..129920e23 100644 --- a/internal/glfw/glfw_windows.go +++ b/internal/glfw/glfw_windows.go @@ -19,27 +19,27 @@ import ( "image" "image/draw" - "github.com/hajimehoshi/ebiten/v2/internal/glfwwin" + "github.com/hajimehoshi/ebiten/v2/internal/goglfw" ) -type Cursor glfwwin.Cursor +type Cursor goglfw.Cursor func CreateStandardCursor(shape StandardCursor) *Cursor { - c, err := glfwwin.CreateStandardCursor(glfwwin.StandardCursor(shape)) + c, err := goglfw.CreateStandardCursor(goglfw.StandardCursor(shape)) if err != nil { panic(err) } return (*Cursor)(c) } -type Monitor glfwwin.Monitor +type Monitor goglfw.Monitor func (m *Monitor) GetContentScale() (float32, float32, error) { - return (*glfwwin.Monitor)(m).GetContentScale() + return (*goglfw.Monitor)(m).GetContentScale() } func (m *Monitor) GetPos() (int, int) { - x, y, err := (*glfwwin.Monitor)(m).GetPos() + x, y, err := (*goglfw.Monitor)(m).GetPos() if err != nil { panic(err) } @@ -47,29 +47,29 @@ func (m *Monitor) GetPos() (int, int) { } func (m *Monitor) GetVideoMode() *VidMode { - v, err := (*glfwwin.Monitor)(m).GetVideoMode() + v, err := (*goglfw.Monitor)(m).GetVideoMode() if err != nil { panic(err) } return (*VidMode)(v) } -type Window glfwwin.Window +type Window goglfw.Window func (w *Window) Destroy() { - if err := (*glfwwin.Window)(w).Destroy(); err != nil { + if err := (*goglfw.Window)(w).Destroy(); err != nil { panic(err) } } func (w *Window) Focus() { - if err := (*glfwwin.Window)(w).Focus(); err != nil { + if err := (*goglfw.Window)(w).Focus(); err != nil { panic(err) } } func (w *Window) GetAttrib(attrib Hint) int { - r, err := (*glfwwin.Window)(w).GetAttrib(glfwwin.Hint(attrib)) + r, err := (*goglfw.Window)(w).GetAttrib(goglfw.Hint(attrib)) if err != nil { panic(err) } @@ -77,7 +77,7 @@ func (w *Window) GetAttrib(attrib Hint) int { } func (w *Window) GetCursorPos() (x, y float64) { - x, y, err := (*glfwwin.Window)(w).GetCursorPos() + x, y, err := (*goglfw.Window)(w).GetCursorPos() if err != nil { panic(err) } @@ -85,7 +85,7 @@ func (w *Window) GetCursorPos() (x, y float64) { } func (w *Window) GetInputMode(mode InputMode) int { - r, err := (*glfwwin.Window)(w).GetInputMode(glfwwin.InputMode(mode)) + r, err := (*goglfw.Window)(w).GetInputMode(goglfw.InputMode(mode)) if err != nil { panic(err) } @@ -93,7 +93,7 @@ func (w *Window) GetInputMode(mode InputMode) int { } func (w *Window) GetKey(key Key) Action { - r, err := (*glfwwin.Window)(w).GetKey(glfwwin.Key(key)) + r, err := (*goglfw.Window)(w).GetKey(goglfw.Key(key)) if err != nil { panic(err) } @@ -101,7 +101,7 @@ func (w *Window) GetKey(key Key) Action { } func (w *Window) GetMonitor() *Monitor { - m, err := (*glfwwin.Window)(w).GetMonitor() + m, err := (*goglfw.Window)(w).GetMonitor() if err != nil { panic(err) } @@ -109,7 +109,7 @@ func (w *Window) GetMonitor() *Monitor { } func (w *Window) GetMouseButton(button MouseButton) Action { - r, err := (*glfwwin.Window)(w).GetMouseButton(glfwwin.MouseButton(button)) + r, err := (*goglfw.Window)(w).GetMouseButton(goglfw.MouseButton(button)) if err != nil { panic(err) } @@ -117,7 +117,7 @@ func (w *Window) GetMouseButton(button MouseButton) Action { } func (w *Window) GetPos() (int, int) { - x, y, err := (*glfwwin.Window)(w).GetPos() + x, y, err := (*goglfw.Window)(w).GetPos() if err != nil { panic(err) } @@ -125,7 +125,7 @@ func (w *Window) GetPos() (int, int) { } func (w *Window) GetSize() (int, int) { - width, height, err := (*glfwwin.Window)(w).GetSize() + width, height, err := (*goglfw.Window)(w).GetSize() if err != nil { panic(err) } @@ -133,43 +133,43 @@ func (w *Window) GetSize() (int, int) { } func (w *Window) Hide() { - if err := (*glfwwin.Window)(w).Hide(); err != nil { + if err := (*goglfw.Window)(w).Hide(); err != nil { panic(err) } } func (w *Window) Iconify() { - if err := (*glfwwin.Window)(w).Iconify(); err != nil { + if err := (*goglfw.Window)(w).Iconify(); err != nil { panic(err) } } func (w *Window) MakeContextCurrent() { - if err := (*glfwwin.Window)(w).MakeContextCurrent(); err != nil { + if err := (*goglfw.Window)(w).MakeContextCurrent(); err != nil { panic(err) } } func (w *Window) Maximize() { - if err := (*glfwwin.Window)(w).Maximize(); err != nil { + if err := (*goglfw.Window)(w).Maximize(); err != nil { panic(err) } } func (w *Window) Restore() { - if err := (*glfwwin.Window)(w).Restore(); err != nil { + if err := (*goglfw.Window)(w).Restore(); err != nil { panic(err) } } func (w *Window) SetAttrib(attrib Hint, value int) { - if err := (*glfwwin.Window)(w).SetAttrib(glfwwin.Hint(attrib), value); err != nil { + if err := (*goglfw.Window)(w).SetAttrib(goglfw.Hint(attrib), value); err != nil { panic(err) } } func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsCallback) { - f, err := (*glfwwin.Window)(w).SetCharModsCallback(cbfun) + f, err := (*goglfw.Window)(w).SetCharModsCallback(cbfun) if err != nil { panic(err) } @@ -177,7 +177,7 @@ func (w *Window) SetCharModsCallback(cbfun CharModsCallback) (previous CharModsC } func (w *Window) SetCloseCallback(cbfun CloseCallback) (previous CloseCallback) { - f, err := (*glfwwin.Window)(w).SetCloseCallback(cbfun) + f, err := (*goglfw.Window)(w).SetCloseCallback(cbfun) if err != nil { panic(err) } @@ -185,13 +185,13 @@ func (w *Window) SetCloseCallback(cbfun CloseCallback) (previous CloseCallback) } func (w *Window) SetCursor(cursor *Cursor) { - if err := (*glfwwin.Window)(w).SetCursor((*glfwwin.Cursor)(cursor)); err != nil { + if err := (*goglfw.Window)(w).SetCursor((*goglfw.Cursor)(cursor)); err != nil { panic(err) } } func (w *Window) SetFramebufferSizeCallback(cbfun FramebufferSizeCallback) (previous FramebufferSizeCallback) { - f, err := (*glfwwin.Window)(w).SetFramebufferSizeCallback(cbfun) + f, err := (*goglfw.Window)(w).SetFramebufferSizeCallback(cbfun) if err != nil { panic(err) } @@ -199,7 +199,7 @@ func (w *Window) SetFramebufferSizeCallback(cbfun FramebufferSizeCallback) (prev } func (w *Window) SetScrollCallback(cbfun ScrollCallback) (previous ScrollCallback) { - f, err := (*glfwwin.Window)(w).SetScrollCallback(cbfun) + f, err := (*goglfw.Window)(w).SetScrollCallback(cbfun) if err != nil { panic(err) } @@ -207,13 +207,13 @@ func (w *Window) SetScrollCallback(cbfun ScrollCallback) (previous ScrollCallbac } func (w *Window) SetShouldClose(value bool) { - if err := (*glfwwin.Window)(w).SetShouldClose(value); err != nil { + if err := (*goglfw.Window)(w).SetShouldClose(value); err != nil { panic(err) } } func (w *Window) SetSizeCallback(cbfun SizeCallback) (previous SizeCallback) { - f, err := (*glfwwin.Window)(w).SetSizeCallback(cbfun) + f, err := (*goglfw.Window)(w).SetSizeCallback(cbfun) if err != nil { panic(err) } @@ -221,67 +221,67 @@ func (w *Window) SetSizeCallback(cbfun SizeCallback) (previous SizeCallback) { } func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) { - if err := (*glfwwin.Window)(w).SetSizeLimits(minw, minh, maxw, maxh); err != nil { + if err := (*goglfw.Window)(w).SetSizeLimits(minw, minh, maxw, maxh); err != nil { panic(err) } } func (w *Window) SetAspectRatio(numer, denom int) { - if err := (*glfwwin.Window)(w).SetAspectRatio(numer, denom); err != nil { + if err := (*goglfw.Window)(w).SetAspectRatio(numer, denom); err != nil { panic(err) } } func (w *Window) SetIcon(images []image.Image) { - gimgs := make([]*glfwwin.Image, len(images)) + gimgs := make([]*goglfw.Image, len(images)) for i, img := range images { b := img.Bounds() m := image.NewNRGBA(image.Rect(0, 0, b.Dx(), b.Dy())) draw.Draw(m, m.Bounds(), img, b.Min, draw.Src) - gimgs[i] = &glfwwin.Image{ + gimgs[i] = &goglfw.Image{ Width: b.Dx(), Height: b.Dy(), Pixels: m.Pix, } } - if err := (*glfwwin.Window)(w).SetIcon(gimgs); err != nil { + if err := (*goglfw.Window)(w).SetIcon(gimgs); err != nil { panic(err) } } func (w *Window) SetInputMode(mode InputMode, value int) { - if err := (*glfwwin.Window)(w).SetInputMode(glfwwin.InputMode(mode), value); err != nil { + if err := (*goglfw.Window)(w).SetInputMode(goglfw.InputMode(mode), value); err != nil { panic(err) } } func (w *Window) SetMonitor(monitor *Monitor, xpos, ypos, width, height, refreshRate int) { - if err := (*glfwwin.Window)(w).SetMonitor((*glfwwin.Monitor)(monitor), xpos, ypos, width, height, refreshRate); err != nil { + if err := (*goglfw.Window)(w).SetMonitor((*goglfw.Monitor)(monitor), xpos, ypos, width, height, refreshRate); err != nil { panic(err) } } func (w *Window) SetPos(xpos, ypos int) { - if err := (*glfwwin.Window)(w).SetPos(xpos, ypos); err != nil { + if err := (*goglfw.Window)(w).SetPos(xpos, ypos); err != nil { panic(err) } } func (w *Window) SetSize(width, height int) { - if err := (*glfwwin.Window)(w).SetSize(width, height); err != nil { + if err := (*goglfw.Window)(w).SetSize(width, height); err != nil { panic(err) } } func (w *Window) SetTitle(title string) { - if err := (*glfwwin.Window)(w).SetTitle(title); err != nil { + if err := (*goglfw.Window)(w).SetTitle(title); err != nil { panic(err) } } func (w *Window) ShouldClose() bool { - r, err := (*glfwwin.Window)(w).ShouldClose() + r, err := (*goglfw.Window)(w).ShouldClose() if err != nil { panic(err) } @@ -289,25 +289,25 @@ func (w *Window) ShouldClose() bool { } func (w *Window) Show() { - if err := (*glfwwin.Window)(w).Show(); err != nil { + if err := (*goglfw.Window)(w).Show(); err != nil { panic(err) } } func (w *Window) SwapBuffers() { - if err := (*glfwwin.Window)(w).SwapBuffers(); err != nil { + if err := (*goglfw.Window)(w).SwapBuffers(); err != nil { panic(err) } } func CreateWindow(width, height int, title string, monitor *Monitor, share *Window) (*Window, error) { - w, err := glfwwin.CreateWindow(width, height, title, (*glfwwin.Monitor)(monitor), (*glfwwin.Window)(share)) + w, err := goglfw.CreateWindow(width, height, title, (*goglfw.Monitor)(monitor), (*goglfw.Window)(share)) // TODO: acceptError(APIUnavailable, VersionUnavailable)? return (*Window)(w), err } func GetKeyName(key Key, scancode int) string { - name, err := glfwwin.GetKeyName(glfwwin.Key(key), scancode) + name, err := goglfw.GetKeyName(goglfw.Key(key), scancode) if err != nil { panic(err) } @@ -315,7 +315,7 @@ func GetKeyName(key Key, scancode int) string { } func GetMonitors() []*Monitor { - ms, err := glfwwin.GetMonitors() + ms, err := goglfw.GetMonitors() if err != nil { panic(err) } @@ -327,7 +327,7 @@ func GetMonitors() []*Monitor { } func GetPrimaryMonitor() *Monitor { - m, err := glfwwin.GetPrimaryMonitor() + m, err := goglfw.GetPrimaryMonitor() if err != nil { panic(err) } @@ -340,27 +340,27 @@ func Init() error { // See go-gl/glfw#292, go-gl/glfw#324, and glfw/glfw#1763 // (#1229). // TODO: acceptError(APIUnavailable, InvalidValue)? - err := glfwwin.Init() - if err != nil && !errors.Is(err, glfwwin.InvalidValue) { + err := goglfw.Init() + if err != nil && !errors.Is(err, goglfw.InvalidValue) { return err } return nil } func PollEvents() { - if err := glfwwin.PollEvents(); err != nil && !errors.Is(err, glfwwin.InvalidValue) { + if err := goglfw.PollEvents(); err != nil && !errors.Is(err, goglfw.InvalidValue) { panic(err) } } func PostEmptyEvent() { - if err := glfwwin.PostEmptyEvent(); err != nil { + if err := goglfw.PostEmptyEvent(); err != nil { panic(err) } } func SetMonitorCallback(cbfun MonitorCallback) MonitorCallback { - f, err := glfwwin.SetMonitorCallback(cbfun) + f, err := goglfw.SetMonitorCallback(cbfun) if err != nil { panic(err) } @@ -368,25 +368,25 @@ func SetMonitorCallback(cbfun MonitorCallback) MonitorCallback { } func SwapInterval(interval int) { - if err := glfwwin.SwapInterval(interval); err != nil { + if err := goglfw.SwapInterval(interval); err != nil { panic(err) } } func Terminate() { - if err := glfwwin.Terminate(); err != nil { + if err := goglfw.Terminate(); err != nil { panic(err) } } func WaitEvents() { - if err := glfwwin.WaitEvents(); err != nil { + if err := goglfw.WaitEvents(); err != nil { panic(err) } } func WindowHint(target Hint, hint int) { - if err := glfwwin.WindowHint(glfwwin.Hint(target), hint); err != nil { + if err := goglfw.WindowHint(goglfw.Hint(target), hint); err != nil { panic(err) } } diff --git a/internal/glfw/native_windows.go b/internal/glfw/native_windows.go index 13638dce2..0c49ad92b 100644 --- a/internal/glfw/native_windows.go +++ b/internal/glfw/native_windows.go @@ -15,11 +15,11 @@ package glfw import ( - "github.com/hajimehoshi/ebiten/v2/internal/glfwwin" + "github.com/hajimehoshi/ebiten/v2/internal/goglfw" ) func (w *Window) GetWin32Window() uintptr { - r, err := (*glfwwin.Window)(w).GetWin32Window() + r, err := (*goglfw.Window)(w).GetWin32Window() if err != nil { panic(err) } diff --git a/internal/glfw/type_windows.go b/internal/glfw/type_windows.go index f08f0df4c..b8825fd2f 100644 --- a/internal/glfw/type_windows.go +++ b/internal/glfw/type_windows.go @@ -15,16 +15,16 @@ package glfw import ( - "github.com/hajimehoshi/ebiten/v2/internal/glfwwin" + "github.com/hajimehoshi/ebiten/v2/internal/goglfw" ) type ( - CharModsCallback = glfwwin.CharModsCallback - CloseCallback = glfwwin.CloseCallback - FramebufferSizeCallback = glfwwin.FramebufferSizeCallback - MonitorCallback = glfwwin.MonitorCallback - ScrollCallback = glfwwin.ScrollCallback - SizeCallback = glfwwin.SizeCallback + CharModsCallback = goglfw.CharModsCallback + CloseCallback = goglfw.CloseCallback + FramebufferSizeCallback = goglfw.FramebufferSizeCallback + MonitorCallback = goglfw.MonitorCallback + ScrollCallback = goglfw.ScrollCallback + SizeCallback = goglfw.SizeCallback ) -type VidMode glfwwin.VidMode +type VidMode goglfw.VidMode diff --git a/internal/glfwwin/api_windows.go b/internal/goglfw/api_windows.go similarity index 92% rename from internal/glfwwin/api_windows.go rename to internal/goglfw/api_windows.go index f9cdf65ce..ffbedde36 100644 --- a/internal/glfwwin/api_windows.go +++ b/internal/goglfw/api_windows.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package glfwwin +package goglfw import ( "errors" @@ -869,7 +869,7 @@ func _AdjustWindowRectEx(lpRect *_RECT, dwStyle uint32, menu bool, dwExStyle uin } r, _, e := procAdjustWindowRectEx.Call(uintptr(unsafe.Pointer(lpRect)), uintptr(dwStyle), bMenu, uintptr(dwExStyle)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: AdjustWindowRectEx failed: %w", e) + return fmt.Errorf("goglfw: AdjustWindowRectEx failed: %w", e) } return nil } @@ -881,7 +881,7 @@ func _AdjustWindowRectExForDpi(lpRect *_RECT, dwStyle uint32, menu bool, dwExSty } r, _, e := procAdjustWindowRectExForDpi.Call(uintptr(unsafe.Pointer(lpRect)), uintptr(dwStyle), bMenu, uintptr(dwExStyle), uintptr(dpi)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: AdjustWindowRectExForDpi failed: %w", e) + return fmt.Errorf("goglfw: AdjustWindowRectExForDpi failed: %w", e) } return nil } @@ -889,7 +889,7 @@ func _AdjustWindowRectExForDpi(lpRect *_RECT, dwStyle uint32, menu bool, dwExSty func _BringWindowToTop(hWnd windows.HWND) error { r, _, e := procBringWindowToTop.Call(uintptr(hWnd)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: BringWindowToTop failed: %w", e) + return fmt.Errorf("goglfw: BringWindowToTop failed: %w", e) } return nil } @@ -900,7 +900,7 @@ func _ChangeDisplaySettingsExW(deviceName string, lpDevMode *_DEVMODEW, hwnd win var err error lpszDeviceName, err = windows.UTF16PtrFromString(deviceName) if err != nil { - panic("glfwwin: device name must not include a NUL character") + panic("goglfw: device name must not include a NUL character") } } @@ -914,7 +914,7 @@ func _ChangeDisplaySettingsExW(deviceName string, lpDevMode *_DEVMODEW, hwnd win func _ChangeWindowMessageFilterEx(hwnd windows.HWND, message uint32, action uint32, pChangeFilterStruct *_CHANGEFILTERSTRUCT) error { r, _, e := procChangeWindowMessageFilterEx.Call(uintptr(hwnd), uintptr(message), uintptr(action), uintptr(unsafe.Pointer(pChangeFilterStruct))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: ChangeWindowMessageFilterEx failed: %w", e) + return fmt.Errorf("goglfw: ChangeWindowMessageFilterEx failed: %w", e) } return nil } @@ -922,7 +922,7 @@ func _ChangeWindowMessageFilterEx(hwnd windows.HWND, message uint32, action uint func _ChoosePixelFormat(hdc _HDC, ppfd *_PIXELFORMATDESCRIPTOR) (int32, error) { r, _, e := procChoosePixelFormat.Call(uintptr(hdc), uintptr(unsafe.Pointer(ppfd))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, fmt.Errorf("glfwwin: ChoosePixelFormat failed: %w", e) + return 0, fmt.Errorf("goglfw: ChoosePixelFormat failed: %w", e) } return int32(r), nil } @@ -930,7 +930,7 @@ func _ChoosePixelFormat(hdc _HDC, ppfd *_PIXELFORMATDESCRIPTOR) (int32, error) { func _ClientToScreen(hWnd windows.HWND, lpPoint *_POINT) error { r, _, e := procClientToScreen.Call(uintptr(hWnd), uintptr(unsafe.Pointer(lpPoint))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: ClientToScreen failed: %w", e) + return fmt.Errorf("goglfw: ClientToScreen failed: %w", e) } return nil } @@ -938,7 +938,7 @@ func _ClientToScreen(hWnd windows.HWND, lpPoint *_POINT) error { func _ClipCursor(lpRect *_RECT) error { r, _, e := procClipCursor.Call(uintptr(unsafe.Pointer(lpRect))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: ClipCursor failed: %w", e) + return fmt.Errorf("goglfw: ClipCursor failed: %w", e) } return nil } @@ -946,7 +946,7 @@ func _ClipCursor(lpRect *_RECT) error { func _CreateBitmap(nWidth int32, nHeight int32, nPlanes uint32, nBitCount uint32, lpBits unsafe.Pointer) (_HBITMAP, error) { r, _, e := procCreateBitmap.Call(uintptr(nWidth), uintptr(nHeight), uintptr(nPlanes), uintptr(nBitCount), uintptr(lpBits)) if _HBITMAP(r) == 0 { - return 0, fmt.Errorf("glfwwin: CreateBitmap failed: %w", e) + return 0, fmt.Errorf("goglfw: CreateBitmap failed: %w", e) } return _HBITMAP(r), nil } @@ -956,7 +956,7 @@ func _CreateDIBSection(hdc _HDC, pbmi *_BITMAPV5HEADER, usage uint32, hSection w var bits *byte r, _, e := procCreateDIBSection.Call(uintptr(hdc), uintptr(unsafe.Pointer(pbmi)), uintptr(usage), uintptr(unsafe.Pointer(&bits)), uintptr(hSection), uintptr(offset)) if _HBITMAP(r) == 0 { - return 0, nil, fmt.Errorf("glfwwin: CreateDIBSection failed: %w", e) + return 0, nil, fmt.Errorf("goglfw: CreateDIBSection failed: %w", e) } return _HBITMAP(r), bits, nil } @@ -964,7 +964,7 @@ func _CreateDIBSection(hdc _HDC, pbmi *_BITMAPV5HEADER, usage uint32, hSection w func _CreateRectRgn(x1, y1, x2, y2 int32) (_HRGN, error) { r, _, e := procCreateRectRgn.Call(uintptr(x1), uintptr(y1), uintptr(x2), uintptr(y2)) if _HRGN(r) == 0 { - return 0, fmt.Errorf("glfwwin: CreateRectRgn failed: %w", e) + return 0, fmt.Errorf("goglfw: CreateRectRgn failed: %w", e) } return _HRGN(r), nil } @@ -972,7 +972,7 @@ func _CreateRectRgn(x1, y1, x2, y2 int32) (_HRGN, error) { func _CreateIconIndirect(piconinfo *_ICONINFO) (_HICON, error) { r, _, e := procCreateIconIndirect.Call(uintptr(unsafe.Pointer(piconinfo))) if _HICON(r) == 0 { - return 0, fmt.Errorf("glfwwin: CreateIconIndirect failed: %w", e) + return 0, fmt.Errorf("goglfw: CreateIconIndirect failed: %w", e) } return _HICON(r), nil } @@ -983,7 +983,7 @@ func _CreateWindowExW(dwExStyle uint32, className string, windowName string, dwS var err error lpClassName, err = windows.UTF16PtrFromString(className) if err != nil { - panic("glfwwin: class name msut not include a NUL character") + panic("goglfw: class name msut not include a NUL character") } } @@ -992,7 +992,7 @@ func _CreateWindowExW(dwExStyle uint32, className string, windowName string, dwS var err error lpWindowName, err = windows.UTF16PtrFromString(windowName) if err != nil { - panic("glfwwin: window name msut not include a NUL character") + panic("goglfw: window name msut not include a NUL character") } } @@ -1004,7 +1004,7 @@ func _CreateWindowExW(dwExStyle uint32, className string, windowName string, dwS runtime.KeepAlive(lpWindowName) if windows.HWND(r) == 0 { - return 0, fmt.Errorf("glfwwin: CreateWindowExW failed: %w", e) + return 0, fmt.Errorf("goglfw: CreateWindowExW failed: %w", e) } return windows.HWND(r), nil } @@ -1017,7 +1017,7 @@ func _DefWindowProcW(hWnd windows.HWND, uMsg uint32, wParam _WPARAM, lParam _LPA func _DestroyIcon(hIcon _HICON) error { r, _, e := procDestroyIcon.Call(uintptr(hIcon)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: DestroyIcon failed: %w", e) + return fmt.Errorf("goglfw: DestroyIcon failed: %w", e) } return nil } @@ -1025,7 +1025,7 @@ func _DestroyIcon(hIcon _HICON) error { func _DestroyWindow(hWnd windows.HWND) error { r, _, e := procDestroyWindow.Call(uintptr(hWnd)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: DestroyWindow failed: %w", e) + return fmt.Errorf("goglfw: DestroyWindow failed: %w", e) } return nil } @@ -1033,7 +1033,7 @@ func _DestroyWindow(hWnd windows.HWND) error { func _DeleteObject(ho _HGDIOBJ) error { r, _, e := procDeleteObject.Call(uintptr(ho)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: DeleteObject failed: %w", e) + return fmt.Errorf("goglfw: DeleteObject failed: %w", e) } return nil } @@ -1041,7 +1041,7 @@ func _DeleteObject(ho _HGDIOBJ) error { func _DescribePixelFormat(hdc _HDC, iPixelFormat int32, nBytes uint32, ppfd *_PIXELFORMATDESCRIPTOR) (int32, error) { r, _, e := procDescribePixelFormat.Call(uintptr(hdc), uintptr(iPixelFormat), uintptr(nBytes), uintptr(unsafe.Pointer(ppfd))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, fmt.Errorf("glfwwin: DescribePixelFormat failed: %w", e) + return 0, fmt.Errorf("goglfw: DescribePixelFormat failed: %w", e) } return int32(r), nil } @@ -1084,7 +1084,7 @@ func _DragQueryPoint(hDrop _HDROP) (_POINT, bool) { func _DwmEnableBlurBehindWindow(hWnd windows.HWND, pBlurBehind *_DWM_BLURBEHIND) error { r, _, _ := procDwmEnableBlurBehindWindow.Call(uintptr(hWnd), uintptr(unsafe.Pointer(pBlurBehind))) if uint32(r) != uint32(windows.S_OK) { - return fmt.Errorf("glfwwin: DwmEnableBlurBehindWindow failed: %w", handleError(windows.Handle(uint32(r)))) + return fmt.Errorf("goglfw: DwmEnableBlurBehindWindow failed: %w", handleError(windows.Handle(uint32(r)))) } return nil } @@ -1094,7 +1094,7 @@ func _DwmGetColorizationColor() (uint32, bool, error) { var opaqueBlend int32 r, _, _ := procDwmGetColorizationColor.Call(uintptr(unsafe.Pointer(&colorization)), uintptr(unsafe.Pointer(&opaqueBlend))) if uint32(r) != uint32(windows.S_OK) { - return 0, false, fmt.Errorf("glfwwin: DwmGetColorizationColor failed: %w", handleError(windows.Handle(uint32(r)))) + return 0, false, fmt.Errorf("goglfw: DwmGetColorizationColor failed: %w", handleError(windows.Handle(uint32(r)))) } return colorization, opaqueBlend != 0, nil } @@ -1102,7 +1102,7 @@ func _DwmGetColorizationColor() (uint32, bool, error) { func _DwmFlush() error { r, _, _ := procDwmFlush.Call() if uint32(r) != uint32(windows.S_OK) { - return fmt.Errorf("glfwwin: DwmFlush failed: %w", handleError(windows.Handle(uint32(r)))) + return fmt.Errorf("goglfw: DwmFlush failed: %w", handleError(windows.Handle(uint32(r)))) } return nil } @@ -1111,7 +1111,7 @@ func _DwmIsCompositionEnabled() (bool, error) { var enabled int32 r, _, _ := procDwmIsCompositionEnabled.Call(uintptr(unsafe.Pointer(&enabled))) if uint32(r) != uint32(windows.S_OK) { - return false, fmt.Errorf("glfwwin: DwmIsCompositionEnabled failed: %w", handleError(windows.Handle(uint32(r)))) + return false, fmt.Errorf("goglfw: DwmIsCompositionEnabled failed: %w", handleError(windows.Handle(uint32(r)))) } return enabled != 0, nil } @@ -1119,7 +1119,7 @@ func _DwmIsCompositionEnabled() (bool, error) { func _EnableNonClientDpiScaling(hwnd windows.HWND) error { r, _, e := procEnableNonClientDpiScaling.Call(uintptr(hwnd)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: EnableNonClientDpiScaling failed: %w", e) + return fmt.Errorf("goglfw: EnableNonClientDpiScaling failed: %w", e) } return nil } @@ -1130,7 +1130,7 @@ func _EnumDisplayDevicesW(device string, iDevNum uint32, dwFlags uint32) (_DISPL var err error lpDevice, err = windows.UTF16PtrFromString(device) if err != nil { - panic("glfwwin: device name must not include a NUL character") + panic("goglfw: device name must not include a NUL character") } } @@ -1148,7 +1148,7 @@ func _EnumDisplayDevicesW(device string, iDevNum uint32, dwFlags uint32) (_DISPL func _EnumDisplayMonitors(hdc _HDC, lprcClip *_RECT, lpfnEnum uintptr, dwData _LPARAM) error { r, _, e := procEnumDisplayMonitors.Call(uintptr(hdc), uintptr(unsafe.Pointer(lprcClip)), uintptr(lpfnEnum), uintptr(dwData)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: EnumDisplayMonitors failed: %w", e) + return fmt.Errorf("goglfw: EnumDisplayMonitors failed: %w", e) } return nil } @@ -1159,7 +1159,7 @@ func _EnumDisplaySettingsExW(deviceName string, iModeNum uint32, dwFlags uint32) var err error lpszDeviceName, err = windows.UTF16PtrFromString(deviceName) if err != nil { - panic("glfwwin: device name must not include a NUL character") + panic("goglfw: device name must not include a NUL character") } } @@ -1181,7 +1181,7 @@ func _EnumDisplaySettingsW(deviceName string, iModeNum uint32) (_DEVMODEW, bool) var err error lpszDeviceName, err = windows.UTF16PtrFromString(deviceName) if err != nil { - panic("glfwwin: device name must not include a NUL character") + panic("goglfw: device name must not include a NUL character") } } @@ -1214,7 +1214,7 @@ func _GetActiveWindow() windows.HWND { func _GetClassLongPtrW(hWnd windows.HWND, nIndex int32) (uintptr, error) { r, _, e := procGetClassLongPtrW.Call(uintptr(hWnd), uintptr(nIndex)) if r == 0 { - return 0, fmt.Errorf("glfwwin: GetClassLongPtrW failed: %w", e) + return 0, fmt.Errorf("goglfw: GetClassLongPtrW failed: %w", e) } return r, nil } @@ -1223,7 +1223,7 @@ func _GetClientRect(hWnd windows.HWND) (_RECT, error) { var rect _RECT r, _, e := procGetClientRect.Call(uintptr(hWnd), uintptr(unsafe.Pointer(&rect))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return _RECT{}, fmt.Errorf("glfwwin: GetClientRect failed: %w", e) + return _RECT{}, fmt.Errorf("goglfw: GetClientRect failed: %w", e) } return rect, nil } @@ -1232,7 +1232,7 @@ func _GetCursorPos() (_POINT, error) { var point _POINT r, _, e := procGetCursorPos.Call(uintptr(unsafe.Pointer(&point))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return _POINT{}, fmt.Errorf("glfwwin: GetCursorPos failed: %w", e) + return _POINT{}, fmt.Errorf("goglfw: GetCursorPos failed: %w", e) } return point, nil } @@ -1240,7 +1240,7 @@ func _GetCursorPos() (_POINT, error) { func _GetDC(hWnd windows.HWND) (_HDC, error) { r, _, e := procGetDC.Call(uintptr(hWnd)) if _HDC(r) == 0 { - return 0, fmt.Errorf("glfwwin: GetDC failed: %w", e) + return 0, fmt.Errorf("goglfw: GetDC failed: %w", e) } return _HDC(r), nil } @@ -1263,7 +1263,7 @@ func _GetKeyState(nVirtKey int32) int16 { func _GetLayeredWindowAttributes(hWnd windows.HWND) (key _COLORREF, alpha byte, flags uint32, err error) { r, _, e := procGetLayeredWindowAttributes.Call(uintptr(hWnd), uintptr(unsafe.Pointer(&key)), uintptr(unsafe.Pointer(&alpha)), uintptr(unsafe.Pointer(&flags))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, 0, 0, fmt.Errorf("glfwwin: GetLayeredWindowAttributes failed: %w", e) + return 0, 0, 0, fmt.Errorf("goglfw: GetLayeredWindowAttributes failed: %w", e) } return } @@ -1280,14 +1280,14 @@ func _GetModuleHandleExW(dwFlags uint32, lpModuleName any) (_HMODULE, error) { if moduleName != "" { p, err := windows.UTF16PtrFromString(moduleName) if err != nil { - panic("glfwwin: module name must not include a NUL character") + panic("goglfw: module name must not include a NUL character") } ptr = unsafe.Pointer(p) } case unsafe.Pointer: ptr = moduleName default: - return 0, fmt.Errorf("glfwwin: GetModuleHandleExW: lpModuleName must be a string or an unsafe.Pointer but %T", moduleName) + return 0, fmt.Errorf("goglfw: GetModuleHandleExW: lpModuleName must be a string or an unsafe.Pointer but %T", moduleName) } var module _HMODULE @@ -1295,7 +1295,7 @@ func _GetModuleHandleExW(dwFlags uint32, lpModuleName any) (_HMODULE, error) { runtime.KeepAlive(ptr) if int32(r) != 1 { - return 0, fmt.Errorf("glfwwin: GetModuleHandleExW failed: %w", e) + return 0, fmt.Errorf("goglfw: GetModuleHandleExW failed: %w", e) } return module, nil } @@ -1323,7 +1323,7 @@ func _GetMonitorInfoW_Ex(hMonitor _HMONITOR) (_MONITORINFOEXW, bool) { func _GetDpiForMonitor(hmonitor _HMONITOR, dpiType _MONITOR_DPI_TYPE) (dpiX, dpiY uint32, err error) { r, _, _ := procGetDpiForMonitor.Call(uintptr(hmonitor), uintptr(dpiType), uintptr(unsafe.Pointer(&dpiX)), uintptr(unsafe.Pointer(&dpiY))) if uint32(r) != uint32(windows.S_OK) { - return 0, 0, fmt.Errorf("glfwwin: GetDpiForMonitor failed: %w", handleError(windows.Handle(uint32(r)))) + return 0, 0, fmt.Errorf("goglfw: GetDpiForMonitor failed: %w", handleError(windows.Handle(uint32(r)))) } return dpiX, dpiY, nil } @@ -1331,7 +1331,7 @@ func _GetDpiForMonitor(hmonitor _HMONITOR, dpiType _MONITOR_DPI_TYPE) (dpiX, dpi func _GetRawInputData(hRawInput _HRAWINPUT, uiCommand uint32, pData unsafe.Pointer, pcbSize *uint32) (uint32, error) { r, _, e := procGetRawInputData.Call(uintptr(hRawInput), uintptr(uiCommand), uintptr(pData), uintptr(unsafe.Pointer(pcbSize)), unsafe.Sizeof(_RAWINPUTHEADER{})) if uint32(r) == (1<<32)-1 { - return 0, fmt.Errorf("glfwwin: GetRawInputData failed: %w", e) + return 0, fmt.Errorf("goglfw: GetRawInputData failed: %w", e) } return uint32(r), nil } @@ -1339,7 +1339,7 @@ func _GetRawInputData(hRawInput _HRAWINPUT, uiCommand uint32, pData unsafe.Point func _GetSystemMetrics(nIndex int32) (int32, error) { r, _, e := procGetSystemMetrics.Call(uintptr(nIndex)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, fmt.Errorf("glfwwin: GetSystemMetrics failed: %w", e) + return 0, fmt.Errorf("goglfw: GetSystemMetrics failed: %w", e) } return int32(r), nil } @@ -1347,7 +1347,7 @@ func _GetSystemMetrics(nIndex int32) (int32, error) { func _GetSystemMetricsForDpi(nIndex int32, dpi uint32) (int32, error) { r, _, e := procGetSystemMetricsForDpi.Call(uintptr(nIndex), uintptr(dpi)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, fmt.Errorf("glfwwin: GetSystemMetrics failed: %w", e) + return 0, fmt.Errorf("goglfw: GetSystemMetrics failed: %w", e) } return int32(r), nil } @@ -1355,7 +1355,7 @@ func _GetSystemMetricsForDpi(nIndex int32, dpi uint32) (int32, error) { func _GetWindowLongW(hWnd windows.HWND, nIndex int32) (int32, error) { r, _, e := procGetWindowLongW.Call(uintptr(hWnd), uintptr(nIndex)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, fmt.Errorf("glfwwin: GetWindowLongW failed: %w", e) + return 0, fmt.Errorf("goglfw: GetWindowLongW failed: %w", e) } return int32(r), nil } @@ -1366,7 +1366,7 @@ func _GetWindowPlacement(hWnd windows.HWND) (_WINDOWPLACEMENT, error) { r, _, e := procGetWindowPlacement.Call(uintptr(hWnd), uintptr(unsafe.Pointer(&wp))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return _WINDOWPLACEMENT{}, fmt.Errorf("glfwwin: GetWindowPlacement failed: %w", e) + return _WINDOWPLACEMENT{}, fmt.Errorf("goglfw: GetWindowPlacement failed: %w", e) } return wp, nil } @@ -1375,7 +1375,7 @@ func _GetWindowRect(hWnd windows.HWND) (_RECT, error) { var rect _RECT r, _, e := procGetWindowRect.Call(uintptr(hWnd), uintptr(unsafe.Pointer(&rect))) if int(r) == 0 { - return _RECT{}, fmt.Errorf("glfwwin: GetWindowRect failed: %w", e) + return _RECT{}, fmt.Errorf("goglfw: GetWindowRect failed: %w", e) } return rect, nil } @@ -1398,7 +1398,7 @@ func _IsZoomed(hWnd windows.HWND) bool { func _LoadCursorW(hInstance _HINSTANCE, lpCursorName uintptr) (_HCURSOR, error) { r, _, e := procLoadCursorW.Call(uintptr(hInstance), lpCursorName) if _HCURSOR(r) == 0 { - return 0, fmt.Errorf("glfwwin: LoadCursorW: %w", e) + return 0, fmt.Errorf("goglfw: LoadCursorW: %w", e) } return _HCURSOR(r), nil } @@ -1406,7 +1406,7 @@ func _LoadCursorW(hInstance _HINSTANCE, lpCursorName uintptr) (_HCURSOR, error) func _LoadImageW(hInst _HINSTANCE, name uintptr, typ uint32, cx int32, cy int32, fuLoad uint32) (windows.Handle, error) { r, _, e := procLoadImageW.Call(uintptr(hInst), name, uintptr(typ), uintptr(cx), uintptr(cy), uintptr(fuLoad)) if windows.Handle(r) == 0 { - return 0, fmt.Errorf("glfwwin: LoadImageW: %w", e) + return 0, fmt.Errorf("goglfw: LoadImageW: %w", e) } return windows.Handle(r), nil } @@ -1428,7 +1428,7 @@ func _MoveWindow(hWnd windows.HWND, x, y, nWidth, nHeight int32, repaint bool) e } r, _, e := procMoveWindow.Call(uintptr(hWnd), uintptr(x), uintptr(y), uintptr(nWidth), uintptr(nHeight), bRepaint) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: MoveWindow: %w", e) + return fmt.Errorf("goglfw: MoveWindow: %w", e) } return nil } @@ -1440,7 +1440,7 @@ func _MsgWaitForMultipleObjects(nCount uint32, pHandles *windows.Handle, waitAll } r, _, e := procMsgWaitForMultipleObjects.Call(uintptr(nCount), uintptr(unsafe.Pointer(pHandles)), fWaitAll, uintptr(dwMilliseconds), uintptr(dwWakeMask)) if uint32(r) == _WAIT_FAILED { - return 0, fmt.Errorf("glfwwin: MsgWaitForMultipleObjects failed: %w", e) + return 0, fmt.Errorf("goglfw: MsgWaitForMultipleObjects failed: %w", e) } return uint32(r), nil } @@ -1458,7 +1458,7 @@ func _PeekMessageW(lpMsg *_MSG, hWnd windows.HWND, wMsgFilterMin uint32, wMsgFil func _PostMessageW(hWnd windows.HWND, msg uint32, wParam _WPARAM, lParam _LPARAM) error { r, _, e := procPostMessageW.Call(uintptr(hWnd), uintptr(msg), uintptr(wParam), uintptr(lParam)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: PostMessageW failed: %w", e) + return fmt.Errorf("goglfw: PostMessageW failed: %w", e) } return nil } @@ -1475,7 +1475,7 @@ func _PtInRect(lprc *_RECT, pt _POINT) bool { // Adjust the alignment for ARM. r, _, _ = procPtInRect.Call(uintptr(unsafe.Pointer(lprc)), 0, uintptr(pt.x), uintptr(pt.y)) default: - panic(fmt.Sprintf("glfwwin: GOARCH=%s is not supported", runtime.GOARCH)) + panic(fmt.Sprintf("goglfw: GOARCH=%s is not supported", runtime.GOARCH)) } } return int32(r) != 0 @@ -1484,7 +1484,7 @@ func _PtInRect(lprc *_RECT, pt _POINT) bool { func _RegisterClassExW(unnamedParam1 *_WNDCLASSEXW) (_ATOM, error) { r, _, e := procRegisterClassExW.Call(uintptr(unsafe.Pointer(unnamedParam1))) if _ATOM(r) == 0 { - return 0, fmt.Errorf("glfwwin: RegisterClassExW failed: %w", e) + return 0, fmt.Errorf("goglfw: RegisterClassExW failed: %w", e) } return _ATOM(r), nil } @@ -1492,7 +1492,7 @@ func _RegisterClassExW(unnamedParam1 *_WNDCLASSEXW) (_ATOM, error) { func _RegisterDeviceNotificationW(hRecipient windows.Handle, notificationFilter unsafe.Pointer, flags uint32) (_HDEVNOTIFY, error) { r, _, e := procRegisterDeviceNotificationW.Call(uintptr(hRecipient), uintptr(notificationFilter), uintptr(flags)) if _HDEVNOTIFY(r) == 0 { - return 0, fmt.Errorf("glfwwin: RegisterDeviceNotificationW failed: %w", e) + return 0, fmt.Errorf("goglfw: RegisterDeviceNotificationW failed: %w", e) } return _HDEVNOTIFY(r), nil } @@ -1504,7 +1504,7 @@ func _RegisterRawInputDevices(pRawInputDevices []_RAWINPUTDEVICE) error { } r, _, e := procRegisterRawInputDevices.Call(uintptr(rawInputDevices), uintptr(len(pRawInputDevices)), unsafe.Sizeof(_RAWINPUTDEVICE{})) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: RegisterRawInputDevices failed: %w", e) + return fmt.Errorf("goglfw: RegisterRawInputDevices failed: %w", e) } return nil } @@ -1512,7 +1512,7 @@ func _RegisterRawInputDevices(pRawInputDevices []_RAWINPUTDEVICE) error { func _ReleaseCapture() error { r, _, e := procReleaseCapture.Call() if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: ReleaseCapture failed: %w", e) + return fmt.Errorf("goglfw: ReleaseCapture failed: %w", e) } return nil } @@ -1534,7 +1534,7 @@ func _RtlVerifyVersionInfo(versionInfo *_OSVERSIONINFOEXW, typeMask uint32, cond // Adjust the alignment for ARM. r, _, _ = procRtlVerifyVersionInfo.Call(uintptr(unsafe.Pointer(versionInfo)), uintptr(typeMask), 0, uintptr(conditionMask), uintptr(conditionMask>>32)) default: - panic(fmt.Sprintf("glfwwin: GOARCH=%s is not supported", runtime.GOARCH)) + panic(fmt.Sprintf("goglfw: GOARCH=%s is not supported", runtime.GOARCH)) } } return int32(r) @@ -1543,7 +1543,7 @@ func _RtlVerifyVersionInfo(versionInfo *_OSVERSIONINFOEXW, typeMask uint32, cond func _ScreenToClient(hWnd windows.HWND, lpPoint *_POINT) error { r, _, e := procScreenToClient.Call(uintptr(hWnd), uintptr(unsafe.Pointer(lpPoint))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: ScreenToClient failed: %w", e) + return fmt.Errorf("goglfw: ScreenToClient failed: %w", e) } return nil } @@ -1566,7 +1566,7 @@ func _SetCursor(hCursor _HCURSOR) _HCURSOR { func _SetCursorPos(x, y int32) error { r, _, e := procSetCursorPos.Call(uintptr(x), uintptr(y)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SetCursorPos failed: %w", e) + return fmt.Errorf("goglfw: SetCursorPos failed: %w", e) } return nil } @@ -1574,7 +1574,7 @@ func _SetCursorPos(x, y int32) error { func _SetFocus(hWnd windows.HWND) (windows.HWND, error) { r, _, e := procSetFocus.Call(uintptr(hWnd)) if windows.HWND(r) == 0 { - return 0, fmt.Errorf("glfwwin: SetFocus failed: %w", e) + return 0, fmt.Errorf("goglfw: SetFocus failed: %w", e) } return windows.HWND(r), nil } @@ -1587,7 +1587,7 @@ func _SetForegroundWindow(hWnd windows.HWND) bool { func _SetLayeredWindowAttributes(hwnd windows.HWND, crKey _COLORREF, bAlpha byte, dwFlags uint32) error { r, _, e := procSetLayeredWindowAttributes.Call(uintptr(hwnd), uintptr(crKey), uintptr(bAlpha), uintptr(dwFlags)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SetLayeredWindowAttributes failed: %w", e) + return fmt.Errorf("goglfw: SetLayeredWindowAttributes failed: %w", e) } return nil } @@ -1595,7 +1595,7 @@ func _SetLayeredWindowAttributes(hwnd windows.HWND, crKey _COLORREF, bAlpha byte func _SetPixelFormat(hdc _HDC, format int32, ppfd *_PIXELFORMATDESCRIPTOR) error { r, _, e := procSetPixelFormat.Call(uintptr(hdc), uintptr(format), uintptr(unsafe.Pointer(ppfd))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SetPixelFormat failed: %w", e) + return fmt.Errorf("goglfw: SetPixelFormat failed: %w", e) } return nil } @@ -1608,7 +1608,7 @@ func _SetProcessDPIAware() bool { func _SetProcessDpiAwareness(value _PROCESS_DPI_AWARENESS) error { r, _, _ := procSetProcessDpiAwareness.Call(uintptr(value)) if uint32(r) != uint32(windows.S_OK) { - return fmt.Errorf("glfwwin: SetProcessDpiAwareness failed: %w", handleError(windows.Handle(uint32(r)))) + return fmt.Errorf("goglfw: SetProcessDpiAwareness failed: %w", handleError(windows.Handle(uint32(r)))) } return nil } @@ -1616,7 +1616,7 @@ func _SetProcessDpiAwareness(value _PROCESS_DPI_AWARENESS) error { func _SetProcessDpiAwarenessContext(value _DPI_AWARENESS_CONTEXT) error { r, _, e := procSetProcessDpiAwarenessContext.Call(uintptr(value)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SetProcessDpiAwarenessContext failed: %w", e) + return fmt.Errorf("goglfw: SetProcessDpiAwarenessContext failed: %w", e) } return nil } @@ -1629,7 +1629,7 @@ func _SetThreadExecutionState(esFlags _EXECUTION_STATE) _EXECUTION_STATE { func _SetWindowLongW(hWnd windows.HWND, nIndex int32, dwNewLong int32) (int32, error) { r, _, e := procSetWindowLongW.Call(uintptr(hWnd), uintptr(nIndex), uintptr(dwNewLong)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, fmt.Errorf("glfwwin: SetWindowLongW failed: %w", e) + return 0, fmt.Errorf("goglfw: SetWindowLongW failed: %w", e) } return int32(r), nil } @@ -1637,7 +1637,7 @@ func _SetWindowLongW(hWnd windows.HWND, nIndex int32, dwNewLong int32) (int32, e func _SetWindowPlacement(hWnd windows.HWND, lpwndpl *_WINDOWPLACEMENT) error { r, _, e := procSetWindowPlacement.Call(uintptr(hWnd), uintptr(unsafe.Pointer(lpwndpl))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SetWindowPlacement failed: %w", e) + return fmt.Errorf("goglfw: SetWindowPlacement failed: %w", e) } return nil } @@ -1645,7 +1645,7 @@ func _SetWindowPlacement(hWnd windows.HWND, lpwndpl *_WINDOWPLACEMENT) error { func _SetWindowPos(hWnd windows.HWND, hWndInsertAfter windows.HWND, x, y, cx, cy int32, uFlags uint32) error { r, _, e := procSetWindowPos.Call(uintptr(hWnd), uintptr(hWndInsertAfter), uintptr(x), uintptr(y), uintptr(cx), uintptr(cy), uintptr(uFlags)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SetWindowPos failed: %w", e) + return fmt.Errorf("goglfw: SetWindowPos failed: %w", e) } return nil } @@ -1654,14 +1654,14 @@ func _SetWindowTextW(hWnd windows.HWND, str string) error { // An empty string is also a valid value. Always create a uint16 pointer. lpString, err := windows.UTF16PtrFromString(str) if err != nil { - panic("glfwwin: str must not include a NUL character") + panic("goglfw: str must not include a NUL character") } r, _, e := procSetWindowTextW.Call(uintptr(hWnd), uintptr(unsafe.Pointer(lpString))) runtime.KeepAlive(lpString) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SetWindowTextW failed: %w", e) + return fmt.Errorf("goglfw: SetWindowTextW failed: %w", e) } return nil } @@ -1674,7 +1674,7 @@ func _ShowWindow(hWnd windows.HWND, nCmdShow int32) bool { func _SwapBuffers(unnamedParam1 _HDC) error { r, _, e := procSwapBuffers.Call(uintptr(unnamedParam1)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SwapBuffers failed: %w", e) + return fmt.Errorf("goglfw: SwapBuffers failed: %w", e) } return nil } @@ -1682,7 +1682,7 @@ func _SwapBuffers(unnamedParam1 _HDC) error { func _SystemParametersInfoW(uiAction uint32, uiParam uint32, pvParam uintptr, fWinIni uint32) error { r, _, e := procSystemParametersInfoW.Call(uintptr(uiAction), uintptr(uiParam), pvParam, uintptr(fWinIni)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: SystemParametersInfoW failed: %w", e) + return fmt.Errorf("goglfw: SystemParametersInfoW failed: %w", e) } return nil } @@ -1690,7 +1690,7 @@ func _SystemParametersInfoW(uiAction uint32, uiParam uint32, pvParam uintptr, fW func _TlsAlloc() (uint32, error) { r, _, e := procTlsAlloc.Call() if uint32(r) == _TLS_OUT_OF_INDEXES { - return 0, fmt.Errorf("glfwwin: TlsAlloc failed: %w", e) + return 0, fmt.Errorf("goglfw: TlsAlloc failed: %w", e) } return uint32(r), nil } @@ -1698,7 +1698,7 @@ func _TlsAlloc() (uint32, error) { func _TlsFree(dwTlsIndex uint32) error { r, _, e := procTlsFree.Call(uintptr(dwTlsIndex)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: TlsFree failed: %w", e) + return fmt.Errorf("goglfw: TlsFree failed: %w", e) } return nil } @@ -1706,7 +1706,7 @@ func _TlsFree(dwTlsIndex uint32) error { func _TlsGetValue(dwTlsIndex uint32) (uintptr, error) { r, _, e := procTlsGetValue.Call(uintptr(dwTlsIndex)) if r == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return 0, fmt.Errorf("glfwwin: TlsGetValue failed: %w", e) + return 0, fmt.Errorf("goglfw: TlsGetValue failed: %w", e) } return r, nil } @@ -1714,7 +1714,7 @@ func _TlsGetValue(dwTlsIndex uint32) (uintptr, error) { func _TlsSetValue(dwTlsIndex uint32, lpTlsValue uintptr) error { r, _, e := procTlsSetValue.Call(uintptr(dwTlsIndex), lpTlsValue) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: TlsSetValue failed: %w", e) + return fmt.Errorf("goglfw: TlsSetValue failed: %w", e) } return nil } @@ -1745,7 +1745,7 @@ func _TranslateMessage(lpMsg *_MSG) bool { func _TrackMouseEvent(lpEventTrack *_TRACKMOUSEEVENT) error { r, _, e := procTrackMouseEvent.Call(uintptr(unsafe.Pointer(lpEventTrack))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: TrackMouseEvent failed: %w", e) + return fmt.Errorf("goglfw: TrackMouseEvent failed: %w", e) } return nil } @@ -1756,7 +1756,7 @@ func _UnregisterClassW(className string, hInstance _HINSTANCE) error { var err error lpClassName, err = windows.UTF16PtrFromString(className) if err != nil { - panic("glfwwin: class name must not include a NUL character") + panic("goglfw: class name must not include a NUL character") } } @@ -1764,7 +1764,7 @@ func _UnregisterClassW(className string, hInstance _HINSTANCE) error { runtime.KeepAlive(lpClassName) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: UnregisterClassW failed: %w", e) + return fmt.Errorf("goglfw: UnregisterClassW failed: %w", e) } return nil } @@ -1772,7 +1772,7 @@ func _UnregisterClassW(className string, hInstance _HINSTANCE) error { func _UnregisterDeviceNotification(handle _HDEVNOTIFY) error { r, _, e := procUnregisterDeviceNotification.Call(uintptr(handle)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: UnregisterDeviceNotification failed: %w", e) + return fmt.Errorf("goglfw: UnregisterDeviceNotification failed: %w", e) } return nil } @@ -1790,7 +1790,7 @@ func _VerSetConditionMask(conditionMask uint64, typeMask uint32, condition byte) func _WaitMessage() error { r, _, e := procWaitMessage.Call() if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: WaitMessage failed: %w", e) + return fmt.Errorf("goglfw: WaitMessage failed: %w", e) } return nil } @@ -1798,7 +1798,7 @@ func _WaitMessage() error { func wglCreateContext(unnamedParam1 _HDC) (_HGLRC, error) { r, _, e := procWGLCreateContext.Call(uintptr(unnamedParam1)) if _HGLRC(r) == 0 { - return 0, fmt.Errorf("glfwwin: wglCreateContext failed: %w", e) + return 0, fmt.Errorf("goglfw: wglCreateContext failed: %w", e) } return _HGLRC(r), nil } @@ -1807,7 +1807,7 @@ func wglCreateContextAttribsARB(hDC _HDC, hshareContext _HGLRC, attribList *int3 r, _, e := syscall.Syscall(procWGLCreateContextAttribsARB, 3, uintptr(hDC), uintptr(hshareContext), uintptr(unsafe.Pointer(attribList))) if _HGLRC(r) == 0 { // TODO: Show more detailed error? See the original implementation. - return 0, fmt.Errorf("glfwwin: wglCreateContextAttribsARB failed: %w", e) + return 0, fmt.Errorf("goglfw: wglCreateContextAttribsARB failed: %w", e) } return _HGLRC(r), nil } @@ -1815,7 +1815,7 @@ func wglCreateContextAttribsARB(hDC _HDC, hshareContext _HGLRC, attribList *int3 func wglDeleteContext(unnamedParam1 _HGLRC) error { r, _, e := procWGLDeleteContext.Call(uintptr(unnamedParam1)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: wglDeleteContext failed: %w", e) + return fmt.Errorf("goglfw: wglDeleteContext failed: %w", e) } return nil } @@ -1851,7 +1851,7 @@ func wglGetExtensionsStringEXT_Available() bool { func wglGetPixelFormatAttribivARB(hdc _HDC, iPixelFormat int32, iLayerPlane int32, nAttributes uint32, piAttributes *int32, piValues *int32) error { r, _, e := syscall.Syscall6(procWGLGetPixelFormatAttribivARB, 6, uintptr(hdc), uintptr(iPixelFormat), uintptr(iLayerPlane), uintptr(nAttributes), uintptr(unsafe.Pointer(piAttributes)), uintptr(unsafe.Pointer(piValues))) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: wglGetPixelFormatAttribivARB failed: %w", e) + return fmt.Errorf("goglfw: wglGetPixelFormatAttribivARB failed: %w", e) } return nil } @@ -1859,7 +1859,7 @@ func wglGetPixelFormatAttribivARB(hdc _HDC, iPixelFormat int32, iLayerPlane int3 func wglGetProcAddress(unnamedParam1 string) uintptr { ptr, err := windows.BytePtrFromString(unnamedParam1) if err != nil { - panic("glfwwin: unnamedParam1 must not include a NUL character") + panic("goglfw: unnamedParam1 must not include a NUL character") } r, _, _ := procWGLGetProcAddress.Call(uintptr(unsafe.Pointer(ptr))) return r @@ -1868,7 +1868,7 @@ func wglGetProcAddress(unnamedParam1 string) uintptr { func wglMakeCurrent(unnamedParam1 _HDC, unnamedParam2 _HGLRC) error { r, _, e := procWGLMakeCurrent.Call(uintptr(unnamedParam1), uintptr(unnamedParam2)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: wglMakeCurrent failed: %w", e) + return fmt.Errorf("goglfw: wglMakeCurrent failed: %w", e) } return nil } @@ -1876,7 +1876,7 @@ func wglMakeCurrent(unnamedParam1 _HDC, unnamedParam2 _HGLRC) error { func wglShareLists(unnamedParam1 _HGLRC, unnamedParam2 _HGLRC) error { r, _, e := procWGLShareLists.Call(uintptr(unnamedParam1), uintptr(unnamedParam2)) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: wglShareLists failed: %w", e) + return fmt.Errorf("goglfw: wglShareLists failed: %w", e) } return nil } @@ -1884,7 +1884,7 @@ func wglShareLists(unnamedParam1 _HGLRC, unnamedParam2 _HGLRC) error { func wglSwapIntervalEXT(interval int32) error { r, _, e := syscall.Syscall(procWGLSwapIntervalEXT, 1, uintptr(interval), 0, 0) if int32(r) == 0 && !errors.Is(e, windows.ERROR_SUCCESS) { - return fmt.Errorf("glfwwin: wglSwapIntervalEXT failed: %w", e) + return fmt.Errorf("goglfw: wglSwapIntervalEXT failed: %w", e) } return nil } diff --git a/internal/glfwwin/context_windows.go b/internal/goglfw/context_windows.go similarity index 85% rename from internal/glfwwin/context_windows.go rename to internal/goglfw/context_windows.go index 7b7b29f3e..602ae5ac6 100644 --- a/internal/glfwwin/context_windows.go +++ b/internal/goglfw/context_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "fmt" @@ -27,13 +27,13 @@ func checkValidContextConfig(ctxconfig *ctxconfig) error { if ctxconfig.source != NativeContextAPI && ctxconfig.source != EGLContextAPI && ctxconfig.source != OSMesaContextAPI { - return fmt.Errorf("glfwwin: invalid context creation API 0x%08X: %w", ctxconfig.source, InvalidEnum) + return fmt.Errorf("goglfw: invalid context creation API 0x%08X: %w", ctxconfig.source, InvalidEnum) } if ctxconfig.client != NoAPI && ctxconfig.client != OpenGLAPI && ctxconfig.client != OpenGLESAPI { - return fmt.Errorf("glfwwin: invalid client API 0x%08X: %w", ctxconfig.client, InvalidEnum) + return fmt.Errorf("goglfw: invalid client API 0x%08X: %w", ctxconfig.client, InvalidEnum) } if ctxconfig.client == OpenGLAPI { @@ -47,25 +47,25 @@ func checkValidContextConfig(ctxconfig *ctxconfig) error { // OpenGL 3.x series ended with version 3.3 // For now, let everything else through - return fmt.Errorf("glfwwin: invalid OpenGL version %d.%d: %w", ctxconfig.major, ctxconfig.minor, InvalidValue) + return fmt.Errorf("goglfw: invalid OpenGL version %d.%d: %w", ctxconfig.major, ctxconfig.minor, InvalidValue) } if ctxconfig.profile != 0 { if ctxconfig.profile != OpenGLCoreProfile && ctxconfig.profile != OpenGLCompatProfile { - return fmt.Errorf("glfwwin: invalid OpenGL profile 0x%08X: %w", ctxconfig.profile, InvalidEnum) + return fmt.Errorf("goglfw: invalid OpenGL profile 0x%08X: %w", ctxconfig.profile, InvalidEnum) } if ctxconfig.major <= 2 || (ctxconfig.major == 3 && ctxconfig.minor < 2) { // Desktop OpenGL context profiles are only defined for version 3.2 // and above - return fmt.Errorf("glfwwin: context profiles are only defined for OpenGL version 3.2 and above: %w", InvalidValue) + return fmt.Errorf("goglfw: context profiles are only defined for OpenGL version 3.2 and above: %w", InvalidValue) } } if ctxconfig.forward && ctxconfig.major <= 2 { // Forward-compatible contexts are only defined for OpenGL version 3.0 and above - return fmt.Errorf("glfwwin: forward-compatibility is only defined for OpenGL version 3.0 and above: %w", InvalidValue) + return fmt.Errorf("goglfw: forward-compatibility is only defined for OpenGL version 3.0 and above: %w", InvalidValue) } } else if ctxconfig.client == OpenGLESAPI { if ctxconfig.major < 1 || ctxconfig.minor < 0 || @@ -76,19 +76,19 @@ func checkValidContextConfig(ctxconfig *ctxconfig) error { // OpenGL ES 2.x series ended with version 2.0 // For now, let everything else through - return fmt.Errorf("glfwwin: invalid OpenGL ES version %d.%d: %w", ctxconfig.major, ctxconfig.minor, InvalidValue) + return fmt.Errorf("goglfw: invalid OpenGL ES version %d.%d: %w", ctxconfig.major, ctxconfig.minor, InvalidValue) } } if ctxconfig.robustness != 0 { if ctxconfig.robustness != NoResetNotification && ctxconfig.robustness != LoseContextOnReset { - return fmt.Errorf("glfwwin: invalid context robustness mode 0x%08X: %w", ctxconfig.robustness, InvalidEnum) + return fmt.Errorf("goglfw: invalid context robustness mode 0x%08X: %w", ctxconfig.robustness, InvalidEnum) } } if ctxconfig.release != 0 { if ctxconfig.release != ReleaseBehaviorNone && ctxconfig.release != ReleaseBehaviorFlush { - return fmt.Errorf("glfwwin: invalid context release behavior 0x%08X: %w", ctxconfig.release, InvalidEnum) + return fmt.Errorf("goglfw: invalid context release behavior 0x%08X: %w", ctxconfig.release, InvalidEnum) } } @@ -268,16 +268,16 @@ func (w *Window) refreshContextAttribs(ctxconfig *ctxconfig) (ferr error) { getIntegerv := w.context.getProcAddress("glGetIntegerv") getString := w.context.getProcAddress("glGetString") if getIntegerv == 0 || getString == 0 { - return fmt.Errorf("glfwwin: entry point retrieval is broken: %w", PlatformError) + return fmt.Errorf("goglfw: entry point retrieval is broken: %w", PlatformError) } r, _, _ := syscall.Syscall(getString, 1, GL_VERSION, 0, 0) version := windows.BytePtrToString((*byte)(unsafe.Pointer(r))) if version == "" { if ctxconfig.client == OpenGLAPI { - return fmt.Errorf("glfwwin: OpenGL version string retrieval is broken: %w", PlatformError) + return fmt.Errorf("goglfw: OpenGL version string retrieval is broken: %w", PlatformError) } else { - return fmt.Errorf("glfwwin: OpenGL ES version string retrieval is broken: %w", PlatformError) + return fmt.Errorf("goglfw: OpenGL ES version string retrieval is broken: %w", PlatformError) } } @@ -295,9 +295,9 @@ func (w *Window) refreshContextAttribs(ctxconfig *ctxconfig) (ferr error) { m := regexp.MustCompile(`^(\d+)(\.(\d+)(\.(\d+))?)?`).FindStringSubmatch(version) if m == nil { if w.context.client == OpenGLAPI { - return fmt.Errorf("glfwwin: no version found in OpenGL version string: %w", PlatformError) + return fmt.Errorf("goglfw: no version found in OpenGL version string: %w", PlatformError) } else { - return fmt.Errorf("glfwwin: no version found in OpenGL ES version string: %w", PlatformError) + return fmt.Errorf("goglfw: no version found in OpenGL ES version string: %w", PlatformError) } } w.context.major, _ = strconv.Atoi(m[1]) @@ -313,9 +313,9 @@ func (w *Window) refreshContextAttribs(ctxconfig *ctxconfig) (ferr error) { // {GLX|WGL}_ARB_create_context extension and fail here if w.context.client == OpenGLAPI { - return fmt.Errorf("glfwwin: requested OpenGL version %d.%d, got version %d.%d: %w", ctxconfig.major, ctxconfig.minor, w.context.major, w.context.minor, VersionUnavailable) + return fmt.Errorf("goglfw: requested OpenGL version %d.%d, got version %d.%d: %w", ctxconfig.major, ctxconfig.minor, w.context.major, w.context.minor, VersionUnavailable) } else { - return fmt.Errorf("glfwwin: requested OpenGL ES version %d.%d, got version %d.%d: %w", ctxconfig.major, ctxconfig.minor, w.context.major, w.context.minor, VersionUnavailable) + return fmt.Errorf("goglfw: requested OpenGL ES version %d.%d, got version %d.%d: %w", ctxconfig.major, ctxconfig.minor, w.context.major, w.context.minor, VersionUnavailable) } } @@ -326,7 +326,7 @@ func (w *Window) refreshContextAttribs(ctxconfig *ctxconfig) (ferr error) { glGetStringi := w.context.getProcAddress("glGetStringi") if glGetStringi == 0 { - return fmt.Errorf("glfwwin: entry point retrieval is broken: %w", PlatformError) + return fmt.Errorf("goglfw: entry point retrieval is broken: %w", PlatformError) } } @@ -464,7 +464,7 @@ func (w *Window) MakeContextCurrent() error { previous := (*Window)(unsafe.Pointer(ptr)) if w != nil && w.context.client == NoAPI { - return fmt.Errorf("glfwwin: cannot make current with a window that has no OpenGL or OpenGL ES context: %w", NoWindowContext) + return fmt.Errorf("goglfw: cannot make current with a window that has no OpenGL or OpenGL ES context: %w", NoWindowContext) } if previous != nil { @@ -500,7 +500,7 @@ func (w *Window) SwapBuffers() error { } if w.context.client == NoAPI { - return fmt.Errorf("glfwwin: cannot swap buffers of a window that has no OpenGL or OpenGL ES context: %w", NoWindowContext) + return fmt.Errorf("goglfw: cannot swap buffers of a window that has no OpenGL or OpenGL ES context: %w", NoWindowContext) } if err := w.context.swapBuffers(w); err != nil { @@ -520,7 +520,7 @@ func SwapInterval(interval int) error { } window := (*Window)(unsafe.Pointer(ptr)) if window == nil { - return fmt.Errorf("glfwwin: cannot set swap interval without a current OpenGL or OpenGL ES context %w", NoCurrentContext) + return fmt.Errorf("goglfw: cannot set swap interval without a current OpenGL or OpenGL ES context %w", NoCurrentContext) } if err := window.context.swapInterval(interval); err != nil { @@ -545,7 +545,7 @@ func ExtensionSupported(extension string) (bool, error) { } window := (*Window)(unsafe.Pointer(ptr)) if window == nil { - return false, fmt.Errorf("glfwwin: cannot query extension without a current OpenGL or OpenGL ES context %w", NoCurrentContext) + return false, fmt.Errorf("goglfw: cannot query extension without a current OpenGL or OpenGL ES context %w", NoCurrentContext) } if window.context.major >= 3 { @@ -559,7 +559,7 @@ func ExtensionSupported(extension string) (bool, error) { for i := 0; i < int(count); i++ { r, _, _ := syscall.Syscall(glGetStringi, 2, GL_EXTENSIONS, uintptr(i), 0) if r == 0 { - return false, fmt.Errorf("glfwwin: extension string retrieval is broken: %w", PlatformError) + return false, fmt.Errorf("goglfw: extension string retrieval is broken: %w", PlatformError) } en := windows.BytePtrToString((*byte)(unsafe.Pointer(r))) @@ -573,7 +573,7 @@ func ExtensionSupported(extension string) (bool, error) { glGetString := window.context.getProcAddress("glGetString") r, _, _ := syscall.Syscall(glGetString, 1, GL_EXTENSIONS, 0, 0) if r == 0 { - return false, fmt.Errorf("glfwwin: extension string retrieval is broken: %w", PlatformError) + return false, fmt.Errorf("goglfw: extension string retrieval is broken: %w", PlatformError) } extensions := windows.BytePtrToString((*byte)(unsafe.Pointer(r))) diff --git a/internal/glfwwin/glfw3h_windows.go b/internal/goglfw/glfw3h_windows.go similarity index 99% rename from internal/glfwwin/glfw3h_windows.go rename to internal/goglfw/glfw3h_windows.go index 85046e5a8..8fafaf3d4 100644 --- a/internal/glfwwin/glfw3h_windows.go +++ b/internal/goglfw/glfw3h_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw const ( NoAPI = 0 diff --git a/internal/glfwwin/init_windows.go b/internal/goglfw/init_windows.go similarity index 98% rename from internal/glfwwin/init_windows.go rename to internal/goglfw/init_windows.go index 2e0a4c15b..76208b3da 100644 --- a/internal/glfwwin/init_windows.go +++ b/internal/goglfw/init_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw func terminate() error { for _, w := range _glfw.windows { diff --git a/internal/glfwwin/input_windows.go b/internal/goglfw/input_windows.go similarity index 92% rename from internal/glfwwin/input_windows.go rename to internal/goglfw/input_windows.go index aba052f47..c8e6ba388 100644 --- a/internal/glfwwin/input_windows.go +++ b/internal/goglfw/input_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "fmt" @@ -142,7 +142,7 @@ func (w *Window) GetInputMode(mode InputMode) (int, error) { case RawMouseMotion: return boolToInt(w.rawMouseMotion), nil default: - return 0, fmt.Errorf("glfwwin: invalid input mode 0x%08X: %w", mode, InvalidEnum) + return 0, fmt.Errorf("goglfw: invalid input mode 0x%08X: %w", mode, InvalidEnum) } } @@ -154,7 +154,7 @@ func (w *Window) SetInputMode(mode InputMode, value int) error { switch mode { case CursorMode: if value != CursorNormal && value != CursorHidden && value != CursorDisabled { - return fmt.Errorf("glfwwin: invalid cursor mode 0x%08X: %w", value, InvalidEnum) + return fmt.Errorf("goglfw: invalid cursor mode 0x%08X: %w", value, InvalidEnum) } if w.cursorMode == value { @@ -215,7 +215,7 @@ func (w *Window) SetInputMode(mode InputMode, value int) error { case RawMouseMotion: if !platformRawMouseMotionSupported() { - return fmt.Errorf("glfwwin: raw mouse motion is not supported on this system: %w", PlatformError) + return fmt.Errorf("goglfw: raw mouse motion is not supported on this system: %w", PlatformError) } if w.rawMouseMotion == intToBool(value) { @@ -229,7 +229,7 @@ func (w *Window) SetInputMode(mode InputMode, value int) error { return nil default: - return fmt.Errorf("glfwwin: invalid input mode 0x%08X: %w", mode, InvalidEnum) + return fmt.Errorf("goglfw: invalid input mode 0x%08X: %w", mode, InvalidEnum) } } @@ -261,7 +261,7 @@ func GetKeyScancode(key Key) (int, error) { } if key < KeySpace || key > KeyLast { - return 0, fmt.Errorf("glfwwin: invalid key %d: %w", key, InvalidEnum) + return 0, fmt.Errorf("goglfw: invalid key %d: %w", key, InvalidEnum) } return platformGetKeyScancode(key), nil @@ -273,7 +273,7 @@ func (w *Window) GetKey(key Key) (Action, error) { } if key < KeySpace || key > KeyLast { - return 0, fmt.Errorf("glfwwin: invalid key %d: %w", key, InvalidEnum) + return 0, fmt.Errorf("goglfw: invalid key %d: %w", key, InvalidEnum) } if w.keys[key] == stick { @@ -291,7 +291,7 @@ func (w *Window) GetMouseButton(button MouseButton) (Action, error) { } if button < MouseButton1 || button > MouseButtonLast { - return 0, fmt.Errorf("glfwwin: invalid mouse button %d: %w", button, InvalidEnum) + return 0, fmt.Errorf("goglfw: invalid mouse button %d: %w", button, InvalidEnum) } if w.mouseButtons[button] == stick { @@ -321,7 +321,7 @@ func (w *Window) SetCursorPos(xpos, ypos float64) error { } if xpos != xpos || xpos < -math.MaxFloat64 || xpos > math.MaxFloat64 || ypos != ypos || ypos < -math.MaxFloat64 || ypos > math.MaxFloat64 { - return fmt.Errorf("glfwwin: invalid cursor position %f %f: %w", xpos, ypos, InvalidValue) + return fmt.Errorf("goglfw: invalid cursor position %f %f: %w", xpos, ypos, InvalidValue) } if !w.platformWindowFocused() { @@ -350,7 +350,7 @@ func CreateStandardCursor(shape StandardCursor) (*Cursor, error) { shape != HandCursor && shape != HResizeCursor && shape != VResizeCursor { - return nil, fmt.Errorf("glfwwin: invalid standard cursor 0x%08X: %w", shape, InvalidEnum) + return nil, fmt.Errorf("goglfw: invalid standard cursor 0x%08X: %w", shape, InvalidEnum) } cursor := &Cursor{} diff --git a/internal/glfwwin/internal_windows.go b/internal/goglfw/internal_windows.go similarity index 99% rename from internal/glfwwin/internal_windows.go rename to internal/goglfw/internal_windows.go index 8c8e19a49..92e15e138 100644 --- a/internal/glfwwin/internal_windows.go +++ b/internal/goglfw/internal_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "unsafe" diff --git a/internal/glfwwin/monitor_windows.go b/internal/goglfw/monitor_windows.go similarity index 99% rename from internal/glfwwin/monitor_windows.go rename to internal/goglfw/monitor_windows.go index d96029d73..44eff79cd 100644 --- a/internal/glfwwin/monitor_windows.go +++ b/internal/goglfw/monitor_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "sort" diff --git a/internal/glfwwin/wglcontext_windows.go b/internal/goglfw/wglcontext_windows.go similarity index 96% rename from internal/glfwwin/wglcontext_windows.go rename to internal/goglfw/wglcontext_windows.go index 81de11ba4..4eee347b4 100644 --- a/internal/glfwwin/wglcontext_windows.go +++ b/internal/goglfw/wglcontext_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "errors" @@ -197,12 +197,12 @@ func (w *Window) choosePixelFormat(ctxconfig *ctxconfig, fbconfig_ *fbconfig) (i } if len(usableConfigs) == 0 { - return 0, fmt.Errorf("glfwwin: the driver does not appear to support OpenGL") + return 0, fmt.Errorf("goglfw: the driver does not appear to support OpenGL") } closest := chooseFBConfig(fbconfig_, usableConfigs) if closest == nil { - return 0, fmt.Errorf("glfwwin: failed to find a suitable pixel format") + return 0, fmt.Errorf("goglfw: failed to find a suitable pixel format") } return int(closest.handle), nil @@ -337,7 +337,7 @@ func destroyContextWGL(window *Window) error { func initWGL() error { if microsoftgdk.IsXbox() { - return fmt.Errorf("glfwwin: WGL is not available in Xbox") + return fmt.Errorf("goglfw: WGL is not available in Xbox") } if _glfw.wgl.inited { @@ -451,15 +451,15 @@ func (w *Window) createContextWGL(ctxconfig *ctxconfig, fbconfig *fbconfig) erro if ctxconfig.client == OpenGLAPI { if ctxconfig.forward && !_glfw.wgl.ARB_create_context { - return fmt.Errorf("glfwwin: a forward compatible OpenGL context requested but WGL_ARB_create_context is unavailable: %w", VersionUnavailable) + return fmt.Errorf("goglfw: a forward compatible OpenGL context requested but WGL_ARB_create_context is unavailable: %w", VersionUnavailable) } if ctxconfig.profile != 0 && !_glfw.wgl.ARB_create_context_profile { - return fmt.Errorf("glfwwin: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable: %w", VersionUnavailable) + return fmt.Errorf("goglfw: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable: %w", VersionUnavailable) } } else { if !_glfw.wgl.ARB_create_context || !_glfw.wgl.ARB_create_context_profile || !_glfw.wgl.EXT_create_context_es2_profile { - return fmt.Errorf("glfwwin: OpenGL ES requested but WGL_ARB_create_context_es2_profile is unavailable: %w", ApiUnavailable) + return fmt.Errorf("goglfw: OpenGL ES requested but WGL_ARB_create_context_es2_profile is unavailable: %w", ApiUnavailable) } } diff --git a/internal/glfwwin/win32init_windows.go b/internal/goglfw/win32init_windows.go similarity index 99% rename from internal/glfwwin/win32init_windows.go rename to internal/goglfw/win32init_windows.go index df8b60d06..82c2988db 100644 --- a/internal/glfwwin/win32init_windows.go +++ b/internal/goglfw/win32init_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "errors" diff --git a/internal/glfwwin/win32monitor_windows.go b/internal/goglfw/win32monitor_windows.go similarity index 92% rename from internal/glfwwin/win32monitor_windows.go rename to internal/goglfw/win32monitor_windows.go index 5d4d812ac..f8fed33e5 100644 --- a/internal/glfwwin/win32monitor_windows.go +++ b/internal/goglfw/win32monitor_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "errors" @@ -189,21 +189,21 @@ func (m *Monitor) setVideoModeWin32(desired *VidMode) error { m.win32.modeChanged = true return nil case _DISP_CHANGE_BADDUALVIEW: - return errors.New("glfwwin: the system uses DualView at Monitor.setVideoModeWin32") + return errors.New("goglfw: the system uses DualView at Monitor.setVideoModeWin32") case _DISP_CHANGE_BADFLAGS: - return errors.New("glfwwin: invalid flags at Monitor.setVideoModeWin32") + return errors.New("goglfw: invalid flags at Monitor.setVideoModeWin32") case _DISP_CHANGE_BADMODE: - return errors.New("glfwwin: graphics mode not supported at Monitor.setVideoModeWin32") + return errors.New("goglfw: graphics mode not supported at Monitor.setVideoModeWin32") case _DISP_CHANGE_BADPARAM: - return errors.New("glfwwin: invalid parameter at Monitor.setVideoModeWin32") + return errors.New("goglfw: invalid parameter at Monitor.setVideoModeWin32") case _DISP_CHANGE_FAILED: - return errors.New("glfwwin: graphics mode failed at Monitor.setVideoModeWin32") + return errors.New("goglfw: graphics mode failed at Monitor.setVideoModeWin32") case _DISP_CHANGE_NOTUPDATED: - return errors.New("glfwwin: failed to write to registry at Monitor.setVideoModeWin32") + return errors.New("goglfw: failed to write to registry at Monitor.setVideoModeWin32") case _DISP_CHANGE_RESTART: - return errors.New("glfwwin: computer restart required at Monitor.setVideoModeWin32") + return errors.New("goglfw: computer restart required at Monitor.setVideoModeWin32") default: - return errors.New("glfwwin: unknown error at Monitor.setVideoModeWin32") + return errors.New("goglfw: unknown error at Monitor.setVideoModeWin32") } } diff --git a/internal/glfwwin/win32platform_windows.go b/internal/goglfw/win32platform_windows.go similarity index 98% rename from internal/glfwwin/win32platform_windows.go rename to internal/goglfw/win32platform_windows.go index 88819798a..4c2ee0a39 100644 --- a/internal/glfwwin/win32platform_windows.go +++ b/internal/goglfw/win32platform_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw const ( _GLFW_WNDCLASSNAME = "GLFW30" diff --git a/internal/glfwwin/win32thread_windows.go b/internal/goglfw/win32thread_windows.go similarity index 84% rename from internal/glfwwin/win32thread_windows.go rename to internal/goglfw/win32thread_windows.go index eff42daf9..70d26d3d0 100644 --- a/internal/glfwwin/win32thread_windows.go +++ b/internal/goglfw/win32thread_windows.go @@ -3,11 +3,11 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw func (t *tls) create() error { if t.win32.allocated { - panic("glfwwin: TLS must not be allocated") + panic("goglfw: TLS must not be allocated") } i, err := _TlsAlloc() @@ -32,7 +32,7 @@ func (t *tls) destroy() error { func (t *tls) get() (uintptr, error) { if !t.win32.allocated { - panic("glfwwin: TLS must be allocated") + panic("goglfw: TLS must be allocated") } return _TlsGetValue(t.win32.index) @@ -40,7 +40,7 @@ func (t *tls) get() (uintptr, error) { func (t *tls) set(value uintptr) error { if !t.win32.allocated { - panic("glfwwin: TLS must be allocated") + panic("goglfw: TLS must be allocated") } return _TlsSetValue(t.win32.index, value) diff --git a/internal/glfwwin/win32window_windows.go b/internal/goglfw/win32window_windows.go similarity index 99% rename from internal/glfwwin/win32window_windows.go rename to internal/goglfw/win32window_windows.go index 3f5ac64f4..86e8e6d17 100644 --- a/internal/glfwwin/win32window_windows.go +++ b/internal/goglfw/win32window_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "errors" @@ -1208,7 +1208,7 @@ func (w *Window) createNativeWindow(wndconfig *wndconfig, fbconfig *fbconfig) er if w.monitor != nil { mi, ok := _GetMonitorInfoW(w.monitor.win32.handle) if !ok { - return fmt.Errorf("glfwwin: GetMonitorInfoW failed") + return fmt.Errorf("goglfw: GetMonitorInfoW failed") } // NOTE: This window placement is temporary and approximate, as the // correct position and size cannot be known until the monitor @@ -1360,7 +1360,7 @@ func registerWindowClassWin32() error { wc.hCursor = cursor className, err := windows.UTF16FromString(_GLFW_WNDCLASSNAME) if err != nil { - panic("glfwwin: _GLFW_WNDCLASSNAME must not inclucde a NUL character") + panic("goglfw: _GLFW_WNDCLASSNAME must not inclucde a NUL character") } wc.lpszClassName = &className[0] defer runtime.KeepAlive(className) @@ -2236,7 +2236,7 @@ func (c *Cursor) platformCreateStandardCursor(shape StandardCursor) error { case VResizeCursor: id = _OCR_SIZENS default: - return fmt.Errorf("glfwwin: invalid shape: %d", shape) + return fmt.Errorf("goglfw: invalid shape: %d", shape) } h, err := _LoadImageW(0, uintptr(id), _IMAGE_CURSOR, 0, 0, _LR_DEFAULTSIZE|_LR_SHARED) @@ -2271,11 +2271,11 @@ func (w *Window) platformSetCursor(cursor *Cursor) error { } func platformSetClipboardString(str string) error { - panic("glfwwin: platformSetClipboardString is not implemented") + panic("goglfw: platformSetClipboardString is not implemented") } func platformGetClipboardString() (string, error) { - panic("glfwwin: platformGetClipboardString is not implemented") + panic("goglfw: platformGetClipboardString is not implemented") } func (w *Window) GetWin32Window() (windows.HWND, error) { diff --git a/internal/glfwwin/window_windows.go b/internal/goglfw/window_windows.go similarity index 94% rename from internal/glfwwin/window_windows.go rename to internal/goglfw/window_windows.go index 3955862c3..2c868cf39 100644 --- a/internal/glfwwin/window_windows.go +++ b/internal/goglfw/window_windows.go @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2006-2019 Camilla Löwy // SPDX-FileCopyrightText: 2022 The Ebitengine Authors -package glfwwin +package goglfw import ( "fmt" @@ -91,7 +91,7 @@ func CreateWindow(width, height int, title string, monitor *Monitor, share *Wind } if width <= 0 || height <= 0 { - return nil, fmt.Errorf("glfwwin: invalid window size %dx%d: %w", width, height, InvalidValue) + return nil, fmt.Errorf("goglfw: invalid window size %dx%d: %w", width, height, InvalidValue) } fbconfig := _glfw.hints.framebuffer @@ -272,7 +272,7 @@ func WindowHint(hint Hint, value int) error { case RefreshRate: _glfw.hints.refreshRate = value default: - return fmt.Errorf("glfwwin: invalid window hint 0x%08X: %w", hint, InvalidEnum) + return fmt.Errorf("goglfw: invalid window hint 0x%08X: %w", hint, InvalidEnum) } return nil } @@ -401,13 +401,13 @@ func (w *Window) SetSizeLimits(minwidth, minheight, maxwidth, maxheight int) err if minwidth != DontCare && minheight != DontCare { if minwidth < 0 || minheight < 0 { - return fmt.Errorf("glfwwin: invalid window minimum size %dx%d: %w", minwidth, minheight, InvalidValue) + return fmt.Errorf("goglfw: invalid window minimum size %dx%d: %w", minwidth, minheight, InvalidValue) } } if maxwidth != DontCare && maxheight != DontCare { if maxwidth < 0 || maxheight < 0 || maxwidth < minwidth || maxheight < minheight { - return fmt.Errorf("glfwwin: invalid window maximum size %dx%d: %w", maxwidth, maxheight, InvalidValue) + return fmt.Errorf("goglfw: invalid window maximum size %dx%d: %w", maxwidth, maxheight, InvalidValue) } } @@ -438,7 +438,7 @@ func (w *Window) SetAspectRatio(numer, denom int) error { if numer != DontCare && denom != DontCare { if numer <= 0 || denom <= 0 { - return fmt.Errorf("glfwwin: invalid window aspect ratio %d:%d: %w", numer, denom, InvalidValue) + return fmt.Errorf("goglfw: invalid window aspect ratio %d:%d: %w", numer, denom, InvalidValue) } } @@ -489,7 +489,7 @@ func (w *Window) SetOpacity(opacity float32) error { } if opacity != opacity || opacity < 0 || opacity > 1 { - return fmt.Errorf("glfwwin: invalid window opacity %f: %w", opacity, InvalidValue) + return fmt.Errorf("goglfw: invalid window opacity %f: %w", opacity, InvalidValue) } if err := w.platformSetWindowOpacity(opacity); err != nil { @@ -631,7 +631,7 @@ func (w *Window) GetAttrib(attrib Hint) (int, error) { case ContextNoError: return boolToInt(w.context.noerror), nil default: - return 0, fmt.Errorf("glfwwin: invalid window attribute 0x%08X: %w", attrib, InvalidEnum) + return 0, fmt.Errorf("goglfw: invalid window attribute 0x%08X: %w", attrib, InvalidEnum) } } @@ -683,7 +683,7 @@ func (w *Window) SetAttrib(attrib Hint, value int) error { w.focusOnShow = bValue return nil default: - return fmt.Errorf("glfwwin: invalid window attribute 0x%08X: %w", attrib, InvalidEnum) + return fmt.Errorf("goglfw: invalid window attribute 0x%08X: %w", attrib, InvalidEnum) } } @@ -700,11 +700,11 @@ func (w *Window) SetMonitor(monitor *Monitor, xpos, ypos, width, height, refresh } if width <= 0 || height <= 0 { - return fmt.Errorf("glfwwin: invalid window size %dx%d: %w", width, height, InvalidValue) + return fmt.Errorf("goglfw: invalid window size %dx%d: %w", width, height, InvalidValue) } if refreshRate < 0 && refreshRate != DontCare { - return fmt.Errorf("glfwwin: invalid refresh rate %d: %w", refreshRate, InvalidValue) + return fmt.Errorf("goglfw: invalid refresh rate %d: %w", refreshRate, InvalidValue) } w.videoMode.Width = width @@ -838,7 +838,7 @@ func WaitEventsTimeout(timeout float64) error { return NotInitialized } if timeout != timeout || timeout < 0.0 || timeout > math.MaxFloat64 { - return fmt.Errorf("glfwwin: invalid time %f: %w", timeout, InvalidValue) + return fmt.Errorf("goglfw: invalid time %f: %w", timeout, InvalidValue) } if err := platformWaitEventsTimeout(timeout); err != nil { return err