internal/glfw: change the default client API to No-API

This commit is contained in:
Hajime Hoshi 2023-12-21 04:05:13 +09:00
parent 3184276068
commit b73d63da29
3 changed files with 4 additions and 7 deletions

View File

@ -209,7 +209,7 @@ void glfwDefaultWindowHints(void)
// The default is OpenGL with minimum version 1.0
memset(&_glfw.hints.context, 0, sizeof(_glfw.hints.context));
_glfw.hints.context.client = GLFW_OPENGL_API;
_glfw.hints.context.client = GLFW_NO_API; // This is different from the original GLFW, which uses GLFW_OPENGL_API by default.
_glfw.hints.context.source = GLFW_NATIVE_CONTEXT_API;
_glfw.hints.context.major = 1;
_glfw.hints.context.minor = 0;

View File

@ -160,7 +160,7 @@ func defaultWindowHints() error {
// The default is OpenGL with minimum version 1.0
_glfw.hints.context = ctxconfig{
client: OpenGLAPI,
client: NoAPI, // This is different from the original GLFW, which uses OpenGLAPI by default.
source: NativeContextAPI,
major: 1,
minor: 0,

View File

@ -1106,11 +1106,8 @@ func (u *UserInterface) initOnMainThread(options *RunOptions) error {
u.setGraphicsLibrary(lib)
u.graphicsDriver.SetTransparent(options.ScreenTransparent)
if u.GraphicsLibrary() != GraphicsLibraryOpenGL {
if err := glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI); err != nil {
return err
}
}
// internal/glfw is customized and the default client API is NoAPI, not OpenGLAPI.
// Then, glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI) doesn't have to be called.
// Before creating a window, set it unresizable no matter what u.isInitWindowResizable() is (#1987).
// Making the window resizable here doesn't work correctly when switching to enable resizing.