summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManuel Alfayate Corchete <redwindwanderer@gmail.com>2021-01-31 04:04:26 +0100
committerManuel Alfayate Corchete <redwindwanderer@gmail.com>2021-01-31 04:04:26 +0100
commit242ba3fe83804cff8807507cff6e8427db0027dc (patch)
tree7efe0a423c3813e31d6a1759988e7a6c8206db6d /src
parent61798510f67860377b2f89519e78680ead75ddbd (diff)
downloadsdl-242ba3fe83804cff8807507cff6e8427db0027dc.tar.gz
[KMS/DRM] Merge patch for bug 5522#: Implement KMSDRM_GetWindowWMInfo().
Diffstat (limited to 'src')
-rw-r--r--src/video/kmsdrm/SDL_kmsdrmvideo.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index b5fc16c40..1be7a6133 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -1370,16 +1370,22 @@ KMSDRM_RestoreWindow(_THIS, SDL_Window * window)
SDL_bool
KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
{
- if (info->version.major <= SDL_MAJOR_VERSION) {
- return SDL_TRUE;
- } else {
- SDL_SetError("application not compiled with SDL %d.%d\n",
- SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
- return SDL_FALSE;
- }
-
- /* Failed to get window manager information */
- return SDL_FALSE;
+ SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
+ const Uint32 version = SDL_VERSIONNUM((Uint32)info->version.major,
+ (Uint32)info->version.minor,
+ (Uint32)info->version.patch);
+
+ if (version < SDL_VERSIONNUM(2, 0, 15)) {
+ SDL_SetError("Version must be 2.0.15 or newer");
+ return SDL_FALSE;
+ }
+
+ info->subsystem = SDL_SYSWM_KMSDRM;
+ info->info.kmsdrm.dev_index = viddata->devindex;
+ info->info.kmsdrm.drm_fd = viddata->drm_fd;
+ info->info.kmsdrm.gbm_dev = viddata->gbm_dev;
+
+ return SDL_TRUE;
}
#endif /* SDL_VIDEO_DRIVER_KMSDRM */