mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Move last bits of window setup to platform code
This avoids glfwCreateWindow emitting GLFW_FEATURE_UNAVAILABLE or GLFW_FEATURE_UNIMPLEMENTED on Wayland because shared code was calling unimplemented or unavailable platform functions during final setup. It also makes it consistent with the final setup of full screen windows.
This commit is contained in:
parent
72642ea0d1
commit
09653b8c54
@ -325,6 +325,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_FEATURE_UNAVAILABLE`
|
||||
- [POSIX] Removed use of deprecated function `gettimeofday`
|
||||
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
|
||||
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
|
||||
|
@ -931,13 +931,31 @@ int _glfwCreateWindowCocoa(_GLFWwindow* window,
|
||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (wndconfig->mousePassthrough)
|
||||
_glfwSetWindowMousePassthroughCocoa(window, GLFW_TRUE);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
_glfwShowWindowCocoa(window);
|
||||
_glfwFocusWindowCocoa(window);
|
||||
acquireMonitor(window);
|
||||
|
||||
if (wndconfig->centerCursor)
|
||||
_glfwCenterCursorInContentArea(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wndconfig->visible)
|
||||
{
|
||||
_glfwShowWindowCocoa(window);
|
||||
if (wndconfig->focused)
|
||||
_glfwFocusWindowCocoa(window);
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
|
@ -128,13 +128,31 @@ int _glfwCreateWindowNull(_GLFWwindow* window,
|
||||
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (wndconfig->mousePassthrough)
|
||||
_glfwSetWindowMousePassthroughNull(window, GLFW_TRUE);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
_glfwShowWindowNull(window);
|
||||
_glfwFocusWindowNull(window);
|
||||
acquireMonitor(window);
|
||||
|
||||
if (wndconfig->centerCursor)
|
||||
_glfwCenterCursorInContentArea(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wndconfig->visible)
|
||||
{
|
||||
_glfwShowWindowNull(window);
|
||||
if (wndconfig->focused)
|
||||
_glfwFocusWindowNull(window);
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
|
@ -1493,14 +1493,32 @@ int _glfwCreateWindowWin32(_GLFWwindow* window,
|
||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (wndconfig->mousePassthrough)
|
||||
_glfwSetWindowMousePassthroughWin32(window, GLFW_TRUE);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
_glfwShowWindowWin32(window);
|
||||
_glfwFocusWindowWin32(window);
|
||||
acquireMonitor(window);
|
||||
fitToMonitor(window);
|
||||
|
||||
if (wndconfig->centerCursor)
|
||||
_glfwCenterCursorInContentArea(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wndconfig->visible)
|
||||
{
|
||||
_glfwShowWindowWin32(window);
|
||||
if (wndconfig->focused)
|
||||
_glfwFocusWindowWin32(window);
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
|
28
src/window.c
28
src/window.c
@ -215,40 +215,12 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
window->numer = GLFW_DONT_CARE;
|
||||
window->denom = GLFW_DONT_CARE;
|
||||
|
||||
// Open the actual window and create its context
|
||||
if (!_glfw.platform.createWindow(window, &wndconfig, &ctxconfig, &fbconfig))
|
||||
{
|
||||
glfwDestroyWindow((GLFWwindow*) window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ctxconfig.client != GLFW_NO_API)
|
||||
{
|
||||
if (!_glfwRefreshContextAttribs(window, &ctxconfig))
|
||||
{
|
||||
glfwDestroyWindow((GLFWwindow*) window);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (wndconfig.mousePassthrough)
|
||||
_glfw.platform.setWindowMousePassthrough(window, GLFW_TRUE);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
if (wndconfig.centerCursor)
|
||||
_glfwCenterCursorInContentArea(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wndconfig.visible)
|
||||
{
|
||||
_glfw.platform.showWindow(window);
|
||||
if (wndconfig.focused)
|
||||
_glfw.platform.focusWindow(window);
|
||||
}
|
||||
}
|
||||
|
||||
return (GLFWwindow*) window;
|
||||
}
|
||||
|
||||
|
@ -1730,8 +1730,14 @@ int _glfwCreateWindowWayland(_GLFWwindow* window,
|
||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (wndconfig->mousePassthrough)
|
||||
_glfwSetWindowMousePassthroughWayland(window, GLFW_TRUE);
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1952,13 +1952,31 @@ int _glfwCreateWindowX11(_GLFWwindow* window,
|
||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (wndconfig->mousePassthrough)
|
||||
_glfwSetWindowMousePassthroughX11(window, GLFW_TRUE);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
_glfwShowWindowX11(window);
|
||||
updateWindowMode(window);
|
||||
acquireMonitor(window);
|
||||
|
||||
if (wndconfig->centerCursor)
|
||||
_glfwCenterCursorInContentArea(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wndconfig->visible)
|
||||
{
|
||||
_glfwShowWindowX11(window);
|
||||
if (wndconfig->focused)
|
||||
_glfwFocusWindowX11(window);
|
||||
}
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
|
Loading…
Reference in New Issue
Block a user