From 82be6dd7c919c8d6b6e925294521ba485cc9b689 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 7 Mar 2020 08:48:04 -0800 Subject: [PATCH] Fixed regression in bug 4966 - KMSDRM: Add dynamic modeset support Anthony Pesch I was just communicating with one of the Retropie developers regarding this. This change removed the forced window focus change on creation (https://github.com/inolen/SDL-mirror/commit/3534cb3793f4744509f020f1267f510ec7099366) as part of the change no longer assumes there's only a single window being created. This was perhaps an over-aggressive removal. Due to that change, joystick events are only received if SDL_SetKeyboardFocus is called explicitly, or if the app has specified SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS. I think that part of my change should be reverted to continue setting mouse / keyboard focus to the window being created. If SDL_WINDOW_INPUT_FOCUS is to be used as an input flag the code could be conditional, but that would still leave existing software broken. --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 9fb42e94ce3ff..216c45dab9342 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -808,6 +808,10 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window) viddata->windows[viddata->num_windows++] = window; + /* Focus on the newly created window */ + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); + return 0; error: