diff options
author | wm4 <wm4@nowhere> | 2012-08-03 05:55:02 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-08-03 05:55:02 +0200 |
commit | b4d9647d189a6bb924fc6b415ae18969885f11f1 (patch) | |
tree | f794e727435ef230f52dd1fac7c0f7029dc7b083 /libvo/x11_common.c | |
parent | 11648493db7db164aa8fe01751b7e5c5e5faa810 (diff) | |
download | mpv-b4d9647d189a6bb924fc6b415ae18969885f11f1.tar.bz2 mpv-b4d9647d189a6bb924fc6b415ae18969885f11f1.tar.xz |
mplayer: do not create X11 state in player frontend
This is about the vo_x11_init_state() call. It basically opens a X11
connection. It's called in the main() function once. It's not really
clear why this isn't done on VO creation instead. Maybe one reason was
that --no-fixed-vo used to be the default: when playing a new file, the
full VO state would be free'd and recreated. Keeping the X11 connection
possibly improved things, although the question is how. In summary,
there is no good reason to do this, and it only adds platform specific
details to the player frontend.
Do the X11 initialization in the respective VOs instead.
Diffstat (limited to 'libvo/x11_common.c')
-rw-r--r-- | libvo/x11_common.c | 13 |
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) |