Fixed regression in bug 4966 - KMSDRM: Add dynamic modeset support
authorSam Lantinga <slouken@libsdl.org>
Sat, 07 Mar 2020 08:48:04 -0800
changeset 135923ff45857428d
parent 13591 35b18e76f1a6
child 13593 ea9492fc2eae
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
     1.1 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c	Thu Mar 05 08:43:16 2020 -0800
     1.2 +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c	Sat Mar 07 08:48:04 2020 -0800
     1.3 @@ -808,6 +808,10 @@
     1.4  
     1.5      viddata->windows[viddata->num_windows++] = window;
     1.6  
     1.7 +    /* Focus on the newly created window */
     1.8 +    SDL_SetMouseFocus(window);
     1.9 +    SDL_SetKeyboardFocus(window);
    1.10 +
    1.11      return 0;
    1.12  
    1.13  error: