From 1f482174b5340a01d55b8f611b636c04871d8f4f Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sun, 25 Apr 2021 12:44:35 -0400
Subject: [PATCH] x11: Mark backing_store as NotUseful when creating windows.
This can give some performance boost, and save some resources, as there's no
reason to keep a copy of an SDL window's contents on the server: most SDL
apps are redrawing completely every frame, and the API allows for expose
events to tell an app a redraw is needed anyhow.
(And compositors are free to ignore this setting if it makes sense to do so,
according to the Xlib docs.)
Reference Issue #3776.
---
src/video/x11/SDL_x11window.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 94085f492..82e48d2b5 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -445,6 +445,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
}
xattr.override_redirect = ((window->flags & SDL_WINDOW_TOOLTIP) || (window->flags & SDL_WINDOW_POPUP_MENU)) ? True : False;
+ xattr.backing_store = NotUseful;
xattr.background_pixmap = None;
xattr.border_pixel = 0;
@@ -531,7 +532,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
window->x, window->y, window->w, window->h,
0, depth, InputOutput, visual,
(CWOverrideRedirect | CWBackPixmap | CWBorderPixel |
- CWColormap), &xattr);
+ CWBackingStore | CWColormap), &xattr);
if (!w) {
return SDL_SetError("Couldn't create window");
}