enable shared memory method of getting window screenshot

This commit is contained in:
Chris Lee 2019-03-03 01:46:59 +01:00
parent d682756012
commit 6c36f79aae
3 changed files with 5 additions and 2 deletions

View file

@ -107,6 +107,7 @@ void handle_env_vars()
debug_thumbnails = getenv("DEBUG_THUMBNAILS") != NULL; debug_thumbnails = getenv("DEBUG_THUMBNAILS") != NULL;
debug_timers = getenv("DEBUG_TIMERS") != NULL; debug_timers = getenv("DEBUG_TIMERS") != NULL;
debug_executors = getenv("DEBUG_EXECUTORS") != NULL; debug_executors = getenv("DEBUG_EXECUTORS") != NULL;
thumb_use_shm = getenv("TINT2_THUMBNAIL_SHM") != NULL;
if (debug_fps) { if (debug_fps) {
init_fps_distribution(); init_fps_distribution();
char *s = getenv("TRACING_FPS_THRESHOLD"); char *s = getenv("TRACING_FPS_THRESHOLD");

View file

@ -98,6 +98,7 @@ extern gboolean debug_frames;
extern gboolean debug_thumbnails; extern gboolean debug_thumbnails;
extern double ui_scale_dpi_ref; extern double ui_scale_dpi_ref;
extern double ui_scale_monitor_size_ref; extern double ui_scale_monitor_size_ref;
extern gboolean thumb_use_shm;
typedef struct Panel { typedef struct Panel {
Area area; Area area;

View file

@ -578,11 +578,12 @@ gboolean cairo_surface_is_blank(cairo_surface_t *image_surface)
return empty; return empty;
} }
gboolean thumb_use_shm;
cairo_surface_t *get_window_thumbnail(Window win, int size) cairo_surface_t *get_window_thumbnail(Window win, int size)
{ {
cairo_surface_t *image_surface = NULL; cairo_surface_t *image_surface = NULL;
const gboolean shm_allowed = FALSE; if (thumb_use_shm && server.has_shm && server.composite_manager) {
if (shm_allowed && server.has_shm && server.composite_manager) {
image_surface = get_window_thumbnail_ximage(win, (size_t)size, TRUE); image_surface = get_window_thumbnail_ximage(win, (size_t)size, TRUE);
if (image_surface && cairo_surface_is_blank(image_surface)) { if (image_surface && cairo_surface_is_blank(image_surface)) {
cairo_surface_destroy(image_surface); cairo_surface_destroy(image_surface);