mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
Allow window creation with a specific visual (e.g. for GLX support).
This commit is contained in:
parent
6ad73da390
commit
86954a32c5
3 changed files with 19 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue