summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-19 07:45:16 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-23 13:41:06 +0300
commitbfe569b76ebc19263efbf717728a6da7c413cbac (patch)
tree59bd4aa70aa2fad9d5db0aa0335401d3a93cf2ac
parent6c9d09170d70df6e915b6e98906b7625c0c52c64 (diff)
downloadmpv-bfe569b76ebc19263efbf717728a6da7c413cbac.tar.bz2
mpv-bfe569b76ebc19263efbf717728a6da7c413cbac.tar.xz
Move vo_ontop to options struct
Add a 'struct vo *vo' argument to the x11_common.c functions that access the variable so it's available as vo->opts->vo_ontop. To keep VOs using the old API working create a global vo variable that is set to the currently used old vo. "vo_ontop" will be #defined to "global_vo->opts->vo_ontop", and x11_common.h will add defines like the following when it is included by old VOs: #define vo_x11_ontop() vo_x11_ontop(global_vo) so that they will call the function according to the new declaration.
-rw-r--r--cfg-mplayer.h4
-rw-r--r--command.c4
-rw-r--r--libvo/old_vo_defines.h13
-rw-r--r--libvo/old_vo_wrapper.c3
-rw-r--r--libvo/old_vo_wrapper.h2
-rw-r--r--libvo/video_out.c1
-rw-r--r--libvo/video_out.h1
-rw-r--r--libvo/video_out_internal.h1
-rw-r--r--libvo/vo_xv.c12
-rw-r--r--libvo/w32_common.c2
-rw-r--r--libvo/x11_common.c22
-rw-r--r--libvo/x11_common.h18
-rw-r--r--options.h1
13 files changed, 60 insertions, 24 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 49b8ddccd4..9a07979cd1 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -101,8 +101,8 @@ const m_option_t mplayer_opts[]={
STRINGLIST("ao", audio_driver_list, 0),
FLAG_ON("fixed-vo", fixed_vo, CONF_GLOBAL),
FLAG_OFF("nofixed-vo", fixed_vo, CONF_GLOBAL),
- {"ontop", &vo_ontop, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ FLAG_ON("ontop", vo_ontop, 0),
+ FLAG_OFF("noontop", vo_ontop, 0),
{"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"border", &vo_border, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"noborder", &vo_border, CONF_TYPE_FLAG, 0, 1, 0, NULL},
diff --git a/command.c b/command.c
index 1a7fd635da..3f3c25edf1 100644
--- a/command.c
+++ b/command.c
@@ -1076,8 +1076,8 @@ static int mp_property_vo_flag(m_option_t * prop, int action, void *arg,
static int mp_property_ontop(m_option_t * prop, int action, void *arg,
MPContext * mpctx)
{
- return mp_property_vo_flag(prop, action, arg, VOCTRL_ONTOP, &vo_ontop,
- mpctx);
+ return mp_property_vo_flag(prop, action, arg, VOCTRL_ONTOP,
+ &mpctx->opts.vo_ontop, mpctx);
}
/// Display in the root window (RW)
diff --git a/libvo/old_vo_defines.h b/libvo/old_vo_defines.h
new file mode 100644
index 0000000000..285758038e
--- /dev/null
+++ b/libvo/old_vo_defines.h
@@ -0,0 +1,13 @@
+#ifndef MPLAYER_OLD_VO_DEFINES_H
+#define MPLAYER_OLD_VO_DEFINES_H
+
+#include "options.h"
+#include "video_out.h"
+#include "old_vo_wrapper.h"
+
+// Triggers more defines in x11_common.h
+#define IS_OLD_VO 1
+
+#define vo_ontop global_vo->opts->vo_ontop
+
+#endif
diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c
index d4af6fcc10..825f6da0ee 100644
--- a/libvo/old_vo_wrapper.c
+++ b/libvo/old_vo_wrapper.c
@@ -22,8 +22,11 @@
#include "video_out.h"
#include "sub.h"
+struct vo *global_vo;
+
int old_vo_preinit(struct vo *vo, const char *arg)
{
+ global_vo = vo;
return vo->driver->old_functions->preinit(arg);
}
diff --git a/libvo/old_vo_wrapper.h b/libvo/old_vo_wrapper.h
index 8c89790b85..b81f065497 100644
--- a/libvo/old_vo_wrapper.h
+++ b/libvo/old_vo_wrapper.h
@@ -4,6 +4,8 @@
#include <stdint.h>
#include "video_out.h"
+extern struct vo *global_vo;
+
int old_vo_preinit(struct vo *vo, const char *);
int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height,
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 65e83e299a..bb1e29d0c9 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -47,7 +47,6 @@ int vo_vsync = 0;
int vo_fs = 0;
int vo_fsmode = 0;
float vo_panscan = 0.0f;
-int vo_ontop = 0;
int vo_adapter_num=0;
int vo_refresh_rate=0;
int vo_keepaspect=1;
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 3a67a1983a..5e1e244e8c 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -261,7 +261,6 @@ extern int vo_adapter_num;
extern int vo_refresh_rate;
extern int vo_keepaspect;
extern int vo_rootwin;
-extern int vo_ontop;
extern int vo_border;
extern int vo_gamma_gamma;
diff --git a/libvo/video_out_internal.h b/libvo/video_out_internal.h
index ba37f9ea50..16cdc4c727 100644
--- a/libvo/video_out_internal.h
+++ b/libvo/video_out_internal.h
@@ -30,6 +30,7 @@
#include "libmpcodecs/mp_image.h"
#include "geometry.h"
#include "old_vo_wrapper.h"
+#include "old_vo_defines.h"
static int control(uint32_t request, void *data);
static int config(uint32_t width, uint32_t height, uint32_t d_width,
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index fa25f673e4..15aef38f63 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -22,6 +22,7 @@ Buffer allocation:
#include <stdint.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "video_out.h"
@@ -173,6 +174,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
char *title, uint32_t format)
{
+ struct MPOpts *opts = vo->opts;
XSizeHints hint;
XVisualInfo vinfo;
XGCValues xgcv;
@@ -296,7 +298,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
}
} else
{
- vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height,
+ vo_x11_create_vo_window(vo, &vinfo, vo_dx, vo_dy, d_width, d_height,
flags, CopyFromParent, "xv", title);
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
}
@@ -370,8 +372,8 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
mp_msg(MSGT_VO, MSGL_V, "[xv] dx: %d dy: %d dw: %d dh: %d\n", ctx->drwX,
ctx->drwY, vo_dwidth, vo_dheight);
- if (vo_ontop)
- vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+ if (opts->vo_ontop)
+ vo_x11_setlayer(mDisplay, vo_window, opts->vo_ontop);
return 0;
}
@@ -866,7 +868,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
return VO_FALSE;
return VO_TRUE;
case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen();
+ vo_x11_fullscreen(vo);
/* indended, fallthrough to update panscan on fullscreen/windowed switch */
case VOCTRL_SET_PANSCAN:
if ((vo_fs && (vo_panscan != vo_panscan_amount))
@@ -901,7 +903,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
return vo_xv_get_eq(xv_port, args->name, args->valueptr);
}
case VOCTRL_ONTOP:
- vo_x11_ontop();
+ vo_x11_ontop(vo);
return VO_TRUE;
case VOCTRL_UPDATE_SCREENINFO:
update_xinerama_info();
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index bae8ff3dfe..8fdfc1da24 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -11,6 +11,8 @@
#include "aspect.h"
#include "w32_common.h"
#include "mp_fifo.h"
+// To get "#define vo_ontop global_vo->opts->vo_ontop" etc
+#include "old_vo_defines.h"
extern int enable_mouse_movements;
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 2ed8ff31c6..6f91c2aef0 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -5,6 +5,7 @@
#include <inttypes.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "mp_fifo.h"
#include "x11_common.h"
@@ -1291,11 +1292,12 @@ Window vo_x11_create_smooth_window(Display * mDisplay, Window mRoot,
* This also does the grunt-work like setting Window Manager hints etc.
* If vo_window is already set it just moves and resizes it.
*/
-void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
+void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
unsigned int width, unsigned int height, int flags,
Colormap col_map,
const char *classname, const char *title)
{
+ struct MPOpts *opts = vo->opts;
if (vo_window == None) {
XSizeHints hint;
XEvent xev;
@@ -1326,10 +1328,10 @@ void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
StructureNotifyMask | KeyPressMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | ExposureMask);
}
- if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+ if (opts->vo_ontop) vo_x11_setlayer(mDisplay, vo_window, opts->vo_ontop);
vo_x11_nofs_sizepos(vo_dx, vo_dy, width, height);
if (!!vo_fs != !!(flags & VOFLAG_FULLSCREEN))
- vo_x11_fullscreen();
+ vo_x11_fullscreen(vo);
}
void vo_x11_clearwindow_part(Display * mDisplay, Window vo_window,
@@ -1505,8 +1507,9 @@ static int vo_x11_get_fs_type(int supported)
return type;
}
-void vo_x11_fullscreen(void)
+void vo_x11_fullscreen(struct vo *vo)
{
+ struct MPOpts *opts = vo->opts;
int x, y, w, h;
if (WinID >= 0 || vo_fs_flip)
@@ -1570,8 +1573,8 @@ void vo_x11_fullscreen(void)
XMoveResizeWindow(mDisplay, vo_window, x, y, w, h);
}
/* some WMs lose ontop after fullscreen */
- if ((!(vo_fs)) & vo_ontop)
- vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+ if ((!(vo_fs)) & opts->vo_ontop)
+ vo_x11_setlayer(mDisplay, vo_window, opts->vo_ontop);
XMapRaised(mDisplay, vo_window);
if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // some WMs change window pos on map
@@ -1580,11 +1583,12 @@ void vo_x11_fullscreen(void)
XFlush(mDisplay);
}
-void vo_x11_ontop(void)
+void vo_x11_ontop(struct vo *vo)
{
- vo_ontop = (!(vo_ontop));
+ struct MPOpts *opts = vo->opts;
+ opts->vo_ontop = !opts->vo_ontop;
- vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+ vo_x11_setlayer(mDisplay, vo_window, opts->vo_ontop);
}
/*
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index 2c52eb3163..b19a02377c 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -4,6 +4,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+struct vo;
+
#ifdef X11_FULLSCREEN
#define vo_wm_LAYER 1
@@ -44,7 +46,7 @@ extern void vo_x11_nofs_sizepos(int x, int y, int width, int height);
extern void vo_x11_sizehint( int x, int y, int width, int height, int max );
extern int vo_x11_check_events(Display *mydisplay);
extern void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask);
-extern void vo_x11_fullscreen( void );
+void vo_x11_fullscreen(struct vo *vo);
extern void vo_x11_setlayer( Display * mDisplay,Window vo_window,int layer );
extern void vo_x11_uninit(void);
extern Colormap vo_x11_create_colormap(XVisualInfo *vinfo);
@@ -54,13 +56,13 @@ extern void fstype_help(void);
extern Window vo_x11_create_smooth_window( Display *mDisplay, Window mRoot,
Visual *vis, int x, int y, unsigned int width, unsigned int height,
int depth, Colormap col_map);
-extern void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
- unsigned int width, unsigned int height, int flags,
+void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis,
+ int x, int y, unsigned int width, unsigned int height, int flags,
Colormap col_map, const char *classname, const char *title);
extern void vo_x11_clearwindow_part(Display *mDisplay, Window vo_window,
int img_width, int img_height, int use_fs);
extern void vo_x11_clearwindow( Display *mDisplay, Window vo_window );
-extern void vo_x11_ontop(void);
+void vo_x11_ontop(struct vo *vo);
extern void vo_x11_ewmh_fullscreen( int action );
#endif
@@ -122,4 +124,12 @@ void update_xinerama_info(void);
int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return);
+// Old VOs use incompatible function calls, translate them to new
+// prototypes
+#ifdef IS_OLD_VO
+#define vo_x11_create_vo_window(...) vo_x11_create_vo_window(global_vo, __VA_ARGS__)
+#define vo_x11_fullscreen() vo_x11_fullscreen(global_vo)
+#define vo_x11_ontop() vo_x11_ontop(global_vo)
+#endif
+
#endif /* MPLAYER_X11_COMMON_H */
diff --git a/options.h b/options.h
index 89f5855d66..2d6c8d48e4 100644
--- a/options.h
+++ b/options.h
@@ -5,6 +5,7 @@ typedef struct MPOpts {
char **video_driver_list;
char **audio_driver_list;
int fixed_vo;
+ int vo_ontop;
int correct_pts;
int user_correct_pts;
} MPOpts;