summaryrefslogtreecommitdiffstats
path: root/libvo/x11_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r--libvo/x11_common.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 9f580ba47a..65140359f2 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -383,7 +383,6 @@ void update_xinerama_info(struct vo *vo) {
int vo_init(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
- struct vo_x11_state *x11 = vo->x11;
// int mScreen;
int depth, bpp;
unsigned int mask;
@@ -396,6 +395,12 @@ int vo_init(struct vo *vo)
XWindowAttributes attribs;
char *dispName;
+ if (vo->x11)
+ return 1;
+
+ vo->x11 = vo_x11_init_state();
+ struct vo_x11_state *x11 = vo->x11;
+
if (vo_rootwin)
WinID = 0; // use root window
@@ -422,6 +427,8 @@ int vo_init(struct vo *vo)
{
mp_msg(MSGT_VO, MSGL_ERR,
"vo: couldn't open the X11 display (%s)!\n", dispName);
+ talloc_free(x11);
+ vo->x11 = NULL;
return 0;
}
x11->screen = DefaultScreen(x11->display); // screen ID
@@ -524,6 +531,8 @@ int vo_init(struct vo *vo)
void vo_uninit(struct vo_x11_state *x11)
{
+ if (!x11)
+ return;
if (!x11->display)
{
mp_msg(MSGT_VO, MSGL_V,
@@ -765,6 +774,8 @@ void vo_x11_uninit(struct vo *vo)
x11->last_video_height = 0;
x11->size_changed_during_fs = false;
}
+ vo_uninit(x11);
+ vo->x11 = NULL;
}
static int check_resize(struct vo *vo)