From: Ignacio Casal Quinteiro Date: Mon, 25 Nov 2019 22:01:23 +0000 (+0100) Subject: wip X-Git-Tag: v1.4~35 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7be7244c5ca84995f1e635bcbc65a1e02b4246ed;p=pidgin-chime.git wip --- diff --git a/gst-xcbimagesrc/gstxcbimagesrc.c b/gst-xcbimagesrc/gstxcbimagesrc.c index a9399de..ce561a5 100644 --- a/gst-xcbimagesrc/gstxcbimagesrc.c +++ b/gst-xcbimagesrc/gstxcbimagesrc.c @@ -51,6 +51,10 @@ #define _(x) x #include +#ifdef HAVE_XFIXES +#include +#endif + //#include "gst/glib-compat-private.h" GST_DEBUG_CATEGORY_STATIC (gst_debug_xcbimage_src); @@ -225,18 +229,12 @@ gst_xcbimage_src_open_display (GstXcbImageSrc * s, const gchar * name) use_root_window: #ifdef HAVE_XFIXES - /* check if xfixes supported */ - { - int error_base; - - if (XFixesQueryExtension (s->xcontext->disp, &s->fixes_event_base, - &error_base)) { - s->have_xfixes = TRUE; - GST_DEBUG_OBJECT (s, "X Server supports XFixes"); - } else { - - GST_DEBUG_OBJECT (s, "X Server does not support XFixes"); - } + /* check if xfixes is supported */ + if (xcb_get_extension_data (s->xcontext->conn, &xcb_xfixes_id)->present) { + GST_DEBUG_OBJECT (s, "X Server supports XFixes"); + s->have_xfixes = TRUE; + } else { + GST_DEBUG_OBJECT (s, "X Server does not support XFixes"); } #ifdef HAVE_XDAMAGE diff --git a/gst-xcbimagesrc/xcbimageutil.c b/gst-xcbimagesrc/xcbimageutil.c index 1df09a5..a55fccc 100644 --- a/gst-xcbimagesrc/xcbimageutil.c +++ b/gst-xcbimagesrc/xcbimageutil.c @@ -23,6 +23,8 @@ #include "xcbimageutil.h" +#include + GType gst_meta_xcbimage_api_get_type (void) { @@ -173,6 +175,20 @@ beach: } #endif /* HAVE_XSHM */ +static xcb_connection_t * +get_xcb_connection (Display *dpy) +{ + xcb_connection_t *conn; + + conn = XGetXCBConnection (dpy); + if (xcb_connection_has_error (conn)) { + g_warning ("Could not get XCB connection"); + return NULL; + } + + return conn; +} + /* This function gets the X Display and global info about it. Everything is stored in our object and will be cleaned when the object is disposed. Note here that caps for supported format are generated without any window or @@ -192,6 +208,7 @@ xcbimageutil_xcontext_get (GstElement * parent, const gchar * display_name) g_free (xcontext); return NULL; } + xcontext->conn = get_xcb_connection (xcontext->disp); xcontext->screen = DefaultScreenOfDisplay (xcontext->disp); xcontext->visual = DefaultVisualOfScreen (xcontext->screen); xcontext->root = RootWindowOfScreen (xcontext->screen); diff --git a/gst-xcbimagesrc/xcbimageutil.h b/gst-xcbimagesrc/xcbimageutil.h index 8f4df85..0001908 100644 --- a/gst-xcbimagesrc/xcbimageutil.h +++ b/gst-xcbimagesrc/xcbimageutil.h @@ -35,6 +35,8 @@ #include #endif /* HAVE_XSHM */ +#include + #include #include @@ -75,6 +77,7 @@ typedef struct _GstMetaXcbImage GstMetaXcbImage; */ struct _GstXContext { Display *disp; + xcb_connection_t *conn; Screen *screen;