x11: Don't send diplay-add events for displays connected at init time. Reference Issue #4977.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c
index abfd387..c8f6c54 100644
--- a/src/video/x11/SDL_x11modes.c
+++ b/src/video/x11/SDL_x11modes.c
@@ -291,7 +291,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen,
static int
-X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScreenResources *res)
+X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScreenResources *res, SDL_bool send_event)
{
Atom EDID = X11_XInternAtom(dpy, "EDID", False);
XRROutputInfo *output_info;
@@ -396,7 +396,7 @@ X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScre
display.desktop_mode = mode;
display.current_mode = mode;
display.driverdata = displaydata;
- return SDL_AddVideoDisplay(&display, SDL_TRUE);
+ return SDL_AddVideoDisplay(&display, send_event);
}
static void
@@ -444,7 +444,7 @@ X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent *ev)
}
if (res) {
- X11_AddXRandRDisplay(_this, dpy, screen, ev->output, res);
+ X11_AddXRandRDisplay(_this, dpy, screen, ev->output, res, SDL_TRUE);
X11_XRRFreeScreenResources(res);
}
}
@@ -512,7 +512,7 @@ X11_InitModes_XRandR(_THIS)
(!looking_for_primary && (screen == default_screen) && (res->outputs[output] == primary))) {
continue;
}
- if (X11_AddXRandRDisplay(_this, dpy, screen, res->outputs[output], res) == -1) {
+ if (X11_AddXRandRDisplay(_this, dpy, screen, res->outputs[output], res, SDL_FALSE) == -1) {
break;
}
}