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.
This commit is contained in:
Ryan C. Gordon 2021-04-25 12:44:35 -04:00
parent 9c063468d6
commit 1f482174b5
No known key found for this signature in database
GPG Key ID: FA148B892AB48044

View File

@ -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");
}