Allow window creation with a specific visual (e.g. for GLX support).

This commit is contained in:
gb 2010-03-25 13:54:06 +00:00
parent 6ad73da390
commit 86954a32c5
3 changed files with 19 additions and 5 deletions

View file

@ -55,23 +55,37 @@ static const int x11_event_mask = (KeyPressMask |
ExposureMask |
StructureNotifyMask);
/**
* x11_create_window:
* @display: an X11 #Display
* @width: the requested width, in pixels
* @height: the requested height, in pixels
* @vis: the request visual
*
* Creates a border-less window with the specified dimensions. If @vis
* is %NULL, the default visual for @display will be used. The default
* background color is black.
*
* Return value: the newly created X #Window.
*/
Window
x11_create_window(Display *display, guint width, guint height)
x11_create_window(Display *display, guint width, guint height, Visual *vis)
{
Window root_window, window;
int screen, depth;
Visual *vis;
XSetWindowAttributes xswa;
unsigned long xswa_mask;
XWindowAttributes wattr;
unsigned long black_pixel, white_pixel;
screen = DefaultScreen(display);
vis = DefaultVisual(display, screen);
root_window = RootWindow(display, screen);
black_pixel = BlackPixel(display, screen);
white_pixel = WhitePixel(display, screen);
if (!vis)
vis = DefaultVisual(display, screen);
XGetWindowAttributes(display, root_window, &wattr);
depth = wattr.depth;
if (depth != 15 && depth != 16 && depth != 24 && depth != 32)

View file

@ -32,7 +32,7 @@ int x11_untrap_errors(void)
attribute_hidden;
Window
x11_create_window(Display *display, guint width, guint height)
x11_create_window(Display *display, guint width, guint height, Visual *vis)
attribute_hidden;
gboolean

View file

@ -241,7 +241,7 @@ gst_vaapi_window_x11_create(GstVaapiWindow *window, guint *width, guint *height)
priv->atom_NET_WM_STATE = atoms[0];
priv->atom_NET_WM_STATE_FULLSCREEN = atoms[1];
xid = x11_create_window(dpy, *width, *height);
xid = x11_create_window(dpy, *width, *height, NULL);
if (xid)
XRaiseWindow(dpy, xid);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(window);