static Colormap gst_vaapi_window_glx_create_colormap (GstVaapiWindow * window) { GstVaapiWindowGLXPrivate *const priv = GST_VAAPI_WINDOW_GLX_GET_PRIVATE (window); Display *const dpy = GST_VAAPI_WINDOW_NATIVE_DISPLAY (window); XWindowAttributes wattr; gboolean success = FALSE; if (!priv->cmap) { if (!window->use_foreign_window) { if (!_gst_vaapi_window_glx_ensure_context (window, NULL)) return None; GST_VAAPI_WINDOW_LOCK_DISPLAY (window); x11_trap_errors (); /* XXX: add a GstVaapiDisplayX11:x11-screen property? */ priv->cmap = XCreateColormap (dpy, RootWindow (dpy, DefaultScreen (dpy)), priv->gl_context->visual->visual, AllocNone); success = x11_untrap_errors () == 0; GST_VAAPI_WINDOW_UNLOCK_DISPLAY (window); } else { GST_VAAPI_WINDOW_LOCK_DISPLAY (window); x11_trap_errors (); XGetWindowAttributes (dpy, GST_VAAPI_WINDOW_ID (window), &wattr); priv->cmap = wattr.colormap; success = x11_untrap_errors () == 0; GST_VAAPI_WINDOW_UNLOCK_DISPLAY (window); } if (!success) return None; } return priv->cmap; }
int x11_get_geometry( Display *dpy, Drawable drawable, int *px, int *py, unsigned int *pwidth, unsigned int *pheight ) { Window rootwin; int x, y; unsigned int width, height, border_width, depth; x11_trap_errors(); XGetGeometry( dpy, drawable, &rootwin, &x, &y, &width, &height, &border_width, &depth ); if (x11_untrap_errors()) return 0; if (px) *px = x; if (py) *py = y; if (pwidth) *pwidth = width; if (pheight) *pheight = height; return 1; }
gboolean x11_get_geometry( Display *dpy, Drawable drawable, gint *px, gint *py, guint *pwidth, guint *pheight ) { Window rootwin; int x, y; guint width, height, border_width, depth; x11_trap_errors(); XGetGeometry( dpy, drawable, &rootwin, &x, &y, &width, &height, &border_width, &depth ); if (x11_untrap_errors()) return FALSE; if (px) *px = x; if (py) *py = y; if (pwidth) *pwidth = width; if (pheight) *pheight = height; return TRUE; }
static int is_window(Display *dpy, Drawable drawable) { XWindowAttributes wattr; x11_trap_errors(); XGetWindowAttributes(dpy, drawable, &wattr); return x11_untrap_errors() == 0; }