From 21e0382edd52584996d2eff77de5b841cb7d33e4 Mon Sep 17 00:00:00 2001
From: Ilya Mizus <[EMAIL REDACTED]>
Date: Tue, 13 Aug 2024 17:15:12 +0300
Subject: [PATCH] Fixed secondary screens on KMSDRM (#10535)
* Removed window movement to left top corner that breaks secondary screens on KMSDRM
(cherry picked from commit ce98550cbb282baa9aed293703f042a980a2de81)
(cherry picked from commit 586a2dc721266e105bcd18e690d613ccb71d956b)
---
src/video/kmsdrm/SDL_kmsdrmvideo.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 5510a4cb550b7..003b3fb085141 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -1589,7 +1589,11 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
SDL_SetKeyboardFocus(window);
/* Tell the app that the window has moved to top-left. */
- SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, 0, 0);
+ {
+ SDL_Rect display_bounds;
+ SDL_GetDisplayBounds(SDL_GetDisplayForWindow(window), &display_bounds);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, display_bounds.x, display_bounds.y);
+ }
/* Allocated windata will be freed in KMSDRM_DestroyWindow,
and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow()