summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/window_wayland.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/window_wayland.c b/src/window_wayland.c
index a313a08..7598038 100644
--- a/src/window_wayland.c
+++ b/src/window_wayland.c
@@ -1019,15 +1019,6 @@ static bool window_wayland_create_window(struct stl_window *window, u32 width, u
}
}
-#ifdef STELA_API_OPENGL
- if (!wl_egl_init(wl)) {
- goto err;
- }
- stl_egl_make_current(&wl->egl);
- stl_egl_swap_interval(&wl->egl, (flags & STELA_WINDOW_VSYNC) ? 1 : 0);
- stl_egl_release_current(&wl->egl);
-#endif
-
wl->cursor.serial = 0;
wl->cursor.pointer = NULL;
wl->frame.pointer_x = FRAME_NO_VALUE;
@@ -1035,9 +1026,19 @@ static bool window_wayland_create_window(struct stl_window *window, u32 width, u
wl->frame.scroll_x = FRAME_NO_VALUE;
wl->frame.scroll_y = FRAME_NO_VALUE;
+ // Keep this before egl_init() for optimal window creation speed.
wl_surface_commit(wl->surface);
wl_display_roundtrip(wl->display);
+#ifdef STELA_API_OPENGL
+ if (!wl_egl_init(wl)) {
+ goto err;
+ }
+ stl_egl_make_current(&wl->egl);
+ stl_egl_swap_interval(&wl->egl, (flags & STELA_WINDOW_VSYNC) ? 1 : 0);
+ stl_egl_release_current(&wl->egl);
+#endif
+
return true;
err:
log_error("Failed to create window.");