diff options
author | wm4 <wm4@nowhere> | 2015-09-30 23:31:34 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-09-30 23:31:34 +0200 |
commit | 7c5f41ff5f00a823f4c75b7d9799729a05f943c9 (patch) | |
tree | fddccdae40ceacd75e886d5c665ad1bb34d2d746 /video/out/vo_x11.c | |
parent | a2a2cdb5bc7788012d3976a4d2f3650e58f9f466 (diff) | |
download | mpv-7c5f41ff5f00a823f4c75b7d9799729a05f943c9.tar.bz2 mpv-7c5f41ff5f00a823f4c75b7d9799729a05f943c9.tar.xz |
x11: separate window creation and configuration
This gets rid of an old hack, VOFLAG_HIDDEN. Although handling of it has
been sane for a while, it used to cause much pain, and is still
unintuitive and weird even today.
The main reason for this hack is that OpenGL selects a X11 Visual for
you, and you're supposed to use this Visual when creating the X window
for the OpenGL context. Which means the X window can't be created early
in the common X11 init code, but the OpenGL code needs to do something
before that. API-wise you need separate functions for X11 init and X11
window creation. The VOFLAG_HIDDEN hack conflated window creation and
the entrypoint for resizing on video resolution change into one
function, vo_x11_config_vo_window(). This required all platform backends
to handle this flag, even if they didn't need this mechanism.
Wayland still uses this for minor reasons (alpha support?), so the
wayland backend must be changed before the flag can be entirely removed.
Diffstat (limited to 'video/out/vo_x11.c')
-rw-r--r-- | video/out/vo_x11.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index 4347f8b99e..af8a5f7133 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -196,7 +196,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *fmt, int flags) p->sws->src = *fmt; - vo_x11_config_vo_window(vo, NULL, flags, "x11"); + vo_x11_config_vo_window(vo); if (!resize(vo)) return -1; @@ -402,7 +402,9 @@ static int preinit(struct vo *vo) MP_VERBOSE(vo, "selected visual: %d\n", (int)p->vinfo.visualid); - vo_x11_config_vo_window(vo, &p->vinfo, VOFLAG_HIDDEN, "x11"); + if (!vo_x11_create_vo_window(vo, &p->vinfo, "x11")) + goto error; + p->gc = XCreateGC(x11->display, x11->window, 0, NULL); return 0; |