SDL: Fixed display hotplug events

From 6d64d821fb615d4d0035d98239ac78278d443aa3 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 5 Jul 2024 15:55:56 -0700
Subject: [PATCH] Fixed display hotplug events

The add event was accidentally removed in https://github.com/libsdl-org/SDL/commit/30e176d6ba5f89cd76a533aa4f1666b232c1132c
---
 src/video/SDL_video.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index cd62a059d25b7..e4939cd2da2c0 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -759,7 +759,7 @@ SDL_DisplayID SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send
     _this->displays[_this->num_displays++] = new_display;
 
     id = SDL_GetNextObjectID();
-    SDL_memcpy(new_display, display, sizeof(*new_display));
+    SDL_copyp(new_display, display);
     new_display->id = id;
     new_display->device = _this;
     if (display->name) {
@@ -790,6 +790,10 @@ SDL_DisplayID SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send
 
     SDL_UpdateDesktopBounds();
 
+    if (send_event) {
+        SDL_SendDisplayEvent(new_display, SDL_EVENT_DISPLAY_ADDED, 0);
+    }
+
     return id;
 }