mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-20 15:51:07 +01:00
kmsdrm: Allow windows to be marked as "unfocusable".
In this case, it means a newly-created window on a specific display won't get mouse/keyboard input (which, presumably, will continue to go to a window on a different physical display instead). This also makes SDL_SetWindowFocusable() functional on the kmsdrm backend, to change this flag later, but to be clear, there are no window focus events to jump between displays in this backend, so this is only useful to manually tweak things later. Fixes #14289.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user