SDL: wayland: Don't send keyboard and mouse added events during initialization

From 48f5550651f44275e0b8649720e988676d46af74 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Tue, 28 Jan 2025 13:02:29 -0500
Subject: [PATCH] wayland: Don't send keyboard and mouse added events during
 initialization

Only send them when a device is added post-initialization, as is done on other platforms.
---
 src/video/wayland/SDL_waylandevents.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 8519b245ef781..c5aaf4be2ef5c 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -1987,7 +1987,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat,
         Wayland_input_init_relative_pointer(input->display);
 
         input->pointer_id = SDL_GetNextObjectID();
-        SDL_AddMouse(input->pointer_id, WAYLAND_DEFAULT_POINTER_NAME, true);
+        SDL_AddMouse(input->pointer_id, WAYLAND_DEFAULT_POINTER_NAME, !input->display->initializing);
     } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
         if (input->relative_pointer) {
             zwp_relative_pointer_v1_destroy(input->relative_pointer);
@@ -2028,7 +2028,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat,
                                  input);
 
         input->keyboard_id = SDL_GetNextObjectID();
-        SDL_AddKeyboard(input->keyboard_id, WAYLAND_DEFAULT_KEYBOARD_NAME, true);
+        SDL_AddKeyboard(input->keyboard_id, WAYLAND_DEFAULT_KEYBOARD_NAME, !input->display->initializing);
     } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {
         wl_keyboard_destroy(input->keyboard);
         input->keyboard = NULL;