diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 29c3cf5ce9..0ca82426e7 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -685,6 +685,7 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void) device->MinimizeWindow = KMSDRM_MinimizeWindow; device->RestoreWindow = KMSDRM_RestoreWindow; device->DestroyWindow = KMSDRM_DestroyWindow; + device->SetWindowFocusable = KMSDRM_SetWindowFocusable; device->GL_LoadLibrary = KMSDRM_GLES_LoadLibrary; device->GL_GetProcAddress = KMSDRM_GLES_GetProcAddress; @@ -2197,10 +2198,12 @@ bool KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert SDL_SetNumberProperty(props, SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER, viddata->drm_fd); SDL_SetPointerProperty(props, SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER, viddata->gbm_dev); - /* Focus on the newly created window. - SDL_SetMouseFocus() also takes care of calling KMSDRM_ShowCursor() if necessary. */ - SDL_SetMouseFocus(window); - SDL_SetKeyboardFocus(window); + if ((window->flags & SDL_WINDOW_NOT_FOCUSABLE) == 0) { + /* Focus on the newly created window. + SDL_SetMouseFocus() also takes care of calling KMSDRM_ShowCursor() if necessary. */ + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); + } // Tell the app that the window has moved to top-left. SDL_Rect display_bounds; @@ -2253,5 +2256,9 @@ void KMSDRM_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window) void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window) { } +bool KMSDRM_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, bool focusable) +{ + return true; // this just has to exist or SDL_SetWindowFocusable() will refuse to change the window flag. +} #endif // SDL_VIDEO_DRIVER_KMSDRM diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/video/kmsdrm/SDL_kmsdrmvideo.h index 7c920c137c..86609e98fd 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.h +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.h @@ -237,5 +237,6 @@ extern void KMSDRM_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window); extern void KMSDRM_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window); extern void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window); extern void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window); +extern bool KMSDRM_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, bool focusable); #endif // SDL_kmsdrmvideo_h