]> www.infradead.org Git - pidgin-chime.git/commitdiff
wip
authorIgnacio Casal Quinteiro <qignacio@amazon.com>
Mon, 25 Nov 2019 22:01:23 +0000 (23:01 +0100)
committerIgnacio Casal Quinteiro <qignacio@amazon.com>
Mon, 25 Nov 2019 22:01:23 +0000 (23:01 +0100)
gst-xcbimagesrc/gstxcbimagesrc.c
gst-xcbimagesrc/xcbimageutil.c
gst-xcbimagesrc/xcbimageutil.h

index a9399de7d4db51d40bd893082d2da78a22710adc..ce561a5501aa127701edaec11d27827c00d0d1c0 100644 (file)
 #define _(x) x
 #include <gst/video/video.h>
 
+#ifdef HAVE_XFIXES
+#include <xcb/xfixes.h>
+#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
index 1df09a5415657e51793443cb84d49c2a71de2995..a55fccc34adb627c99a87ecc4205428e90f3bfc7 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "xcbimageutil.h"
 
+#include <X11/Xlib-xcb.h>
+
 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);
index 8f4df8531bcc77c9aa9f043484ade1df9f63f591..00019085d842d3cc8fb2fbb2cc16e2e60ec6f9ca 100644 (file)
@@ -35,6 +35,8 @@
 #include <X11/extensions/XShm.h>
 #endif /* HAVE_XSHM */
 
+#include <xcb/xcb.h>
+
 #include <string.h>
 #include <math.h>
 
@@ -75,6 +77,7 @@ typedef struct _GstMetaXcbImage GstMetaXcbImage;
  */
 struct _GstXContext {
   Display *disp;
+  xcb_connection_t *conn;
 
   Screen *screen;