diff --git a/README.md b/README.md index bcd2d70d..7f7c49d0 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Drag and drop data was misinterpreted as clipboard string - [Wayland] Bugfix: MIME type matching was not performed for clipboard string - [Wayland] Bugfix: The OSMesa library was not unloaded on termination + - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_PLATFORM_ERROR` ## Contact diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 15f9c40e..16198949 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -934,6 +934,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } if (window->monitor) @@ -941,6 +944,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformShowWindow(window); _glfwPlatformFocusWindow(window); acquireMonitor(window); + + if (wndconfig->centerCursor) + _glfwCenterCursorInContentArea(window); + } + else + { + if (wndconfig->visible) + { + _glfwPlatformShowWindow(window); + if (wndconfig->focused) + _glfwPlatformFocusWindow(window); + } } return GLFW_TRUE; diff --git a/src/null_window.c b/src/null_window.c index 045c76a2..e61c2bdd 100644 --- a/src/null_window.c +++ b/src/null_window.c @@ -67,6 +67,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available"); return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } return GLFW_TRUE; diff --git a/src/win32_window.c b/src/win32_window.c index b6defbaa..ca0f355d 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1498,6 +1498,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } if (window->monitor) @@ -1506,6 +1509,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformFocusWindow(window); acquireMonitor(window); fitToMonitor(window); + + if (wndconfig->centerCursor) + _glfwCenterCursorInContentArea(window); + } + else + { + if (wndconfig->visible) + { + _glfwPlatformShowWindow(window); + if (wndconfig->focused) + _glfwPlatformFocusWindow(window); + } } return GLFW_TRUE; diff --git a/src/window.c b/src/window.c index 1fd9c6a0..5d80e436 100644 --- a/src/window.c +++ b/src/window.c @@ -221,30 +221,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, return NULL; } - if (ctxconfig.client != GLFW_NO_API) - { - if (!_glfwRefreshContextAttribs(window, &ctxconfig)) - { - glfwDestroyWindow((GLFWwindow*) window); - return NULL; - } - } - - if (window->monitor) - { - if (wndconfig.centerCursor) - _glfwCenterCursorInContentArea(window); - } - else - { - if (wndconfig.visible) - { - _glfwPlatformShowWindow(window); - if (wndconfig.focused) - _glfwPlatformFocusWindow(window); - } - } - return (GLFWwindow*) window; } diff --git a/src/wl_window.c b/src/wl_window.c index b15fd16a..7f2d7e67 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1925,6 +1925,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } return GLFW_TRUE; diff --git a/src/x11_window.c b/src/x11_window.c index 331652ec..ddda48d7 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2013,6 +2013,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) return GLFW_FALSE; } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; } if (window->monitor) @@ -2020,6 +2023,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, _glfwPlatformShowWindow(window); updateWindowMode(window); acquireMonitor(window); + + if (wndconfig->centerCursor) + _glfwCenterCursorInContentArea(window); + } + else + { + if (wndconfig->visible) + { + _glfwPlatformShowWindow(window); + if (wndconfig->focused) + _glfwPlatformFocusWindow(window); + } } XFlush(_glfw.x11.display);