From 4ad41004e03076d189e21ec3084338ee4855df31 Mon Sep 17 00:00:00 2001 From: fryshorts Date: Sun, 21 Dec 2014 22:32:28 +0100 Subject: [PATCH] linux-capture: Add function to check extensions Add an internal function to check for all the extensions needed by the xshm capture to work. --- plugins/linux-capture/xshm-input.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugins/linux-capture/xshm-input.c b/plugins/linux-capture/xshm-input.c index 6cd305278..9ef7a77db 100644 --- a/plugins/linux-capture/xshm-input.c +++ b/plugins/linux-capture/xshm-input.c @@ -20,6 +20,9 @@ along with this program. If not, see . #include #include #include +#include +#include +#include #include #include @@ -74,6 +77,24 @@ static inline void xshm_resize_texture(struct xshm_data *data) GS_BGRA, 1, NULL, GS_DYNAMIC); } +/** + * Check if the xserver supports all the extensions we need + */ +static bool xshm_check_extensions(xcb_connection_t *xcb) +{ + bool ok = true; + + if (!xcb_get_extension_data(xcb, &xcb_shm_id)->present) { + blog(LOG_ERROR, "Missing SHM extension !"); + ok = false; + } + + if (!xcb_get_extension_data(xcb, &xcb_xinerama_id)->present) + blog(LOG_INFO, "Missing Xinerama extension !"); + + return ok; +} + /** * Update the capture *