diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 0660ae23a..554b0ecad 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -340,6 +340,11 @@ Wayland_VideoInit(_THIS) _this->driverdata = data; + data->xkb_context = WAYLAND_xkb_context_new(0); + if (!data->xkb_context) { + return SDL_SetError("Failed to create XKB context"); + } + data->display = WAYLAND_wl_display_connect(NULL); if (data->display == NULL) { return SDL_SetError("Failed to connect to a Wayland display"); @@ -358,11 +363,6 @@ Wayland_VideoInit(_THIS) // Second roundtrip to receive all output events. WAYLAND_wl_display_roundtrip(data->display); - data->xkb_context = WAYLAND_xkb_context_new(0); - if (!data->xkb_context) { - return SDL_SetError("Failed to create XKB context"); - } - Wayland_InitMouse(); /* Get the surface class name, usually the name of the application */