Wayland: Only create EGL window if using EGL

(cherry picked from commit d578c2ddfe)
This commit is contained in:
Camilla Löwy 2022-06-21 19:52:39 +02:00
parent be333cf0fd
commit e541b7969a

View File

@ -351,6 +351,8 @@ static void resizeWindow(_GLFWwindow* window)
int scale = window->wl.scale; int scale = window->wl.scale;
int scaledWidth = window->wl.width * scale; int scaledWidth = window->wl.width * scale;
int scaledHeight = window->wl.height * scale; int scaledHeight = window->wl.height * scale;
if (window->wl.egl.window)
wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0); wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0);
if (!window->wl.transparent) if (!window->wl.transparent)
setContentAreaOpaque(window); setContentAreaOpaque(window);
@ -772,15 +774,6 @@ static GLFWbool createNativeSurface(_GLFWwindow* window,
wl_surface_set_user_data(window->wl.surface, window); wl_surface_set_user_data(window->wl.surface, window);
window->wl.egl.window = wl_egl_window_create(window->wl.surface,
wndconfig->width,
wndconfig->height);
if (!window->wl.egl.window)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create EGL window");
return GLFW_FALSE;
}
window->wl.width = wndconfig->width; window->wl.width = wndconfig->width;
window->wl.height = wndconfig->height; window->wl.height = wndconfig->height;
window->wl.scale = 1; window->wl.scale = 1;
@ -1880,6 +1873,16 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (ctxconfig->source == GLFW_EGL_CONTEXT_API || if (ctxconfig->source == GLFW_EGL_CONTEXT_API ||
ctxconfig->source == GLFW_NATIVE_CONTEXT_API) ctxconfig->source == GLFW_NATIVE_CONTEXT_API)
{ {
window->wl.egl.window = wl_egl_window_create(window->wl.surface,
wndconfig->width,
wndconfig->height);
if (!window->wl.egl.window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create EGL window");
return GLFW_FALSE;
}
if (!_glfwInitEGL()) if (!_glfwInitEGL())
return GLFW_FALSE; return GLFW_FALSE;
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))