Skip to content

Commit bcf3afb

Browse files
committed
wayland: Suppress initial keymap changed events during initialization
1 parent 8fda423 commit bcf3afb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/video/wayland/SDL_waylandevents.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,12 @@ void Wayland_DisplayInitCursorShapeManager(SDL_VideoData *display)
307307

308308
static void Wayland_SeatSetKeymap(SDL_WaylandSeat *seat)
309309
{
310+
const bool send_event = !seat->display->initializing;
311+
310312
if (seat->keyboard.sdl_keymap &&
311313
seat->keyboard.xkb.current_layout < seat->keyboard.xkb.num_layouts &&
312314
seat->keyboard.sdl_keymap[seat->keyboard.xkb.current_layout] != SDL_GetCurrentKeymap(true)) {
313-
SDL_SetKeymap(seat->keyboard.sdl_keymap[seat->keyboard.xkb.current_layout], true);
315+
SDL_SetKeymap(seat->keyboard.sdl_keymap[seat->keyboard.xkb.current_layout], send_event);
314316
SDL_SetModState(seat->keyboard.pressed_modifiers | seat->keyboard.locked_modifiers);
315317
}
316318
}
@@ -3531,7 +3533,6 @@ void Wayland_DisplayCreateSeat(SDL_VideoData *display, struct wl_seat *wl_seat,
35313533
seat->wl_seat = wl_seat;
35323534
seat->display = display;
35333535
seat->registry_id = id;
3534-
seat->keyboard.xkb.current_layout = XKB_LAYOUT_INVALID;
35353536

35363537
Wayland_SeatCreateDataDevice(seat);
35373538
Wayland_SeatCreatePrimarySelectionDevice(seat);

0 commit comments

Comments
 (0)