w32: use vo_w32_control() for all VOs

This commit is contained in:
wm4 2013-05-16 14:07:41 +02:00
parent d5de75b340
commit 526e969419
3 changed files with 15 additions and 40 deletions

View File

@ -1295,12 +1295,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
d3d_priv *priv = vo->priv; d3d_priv *priv = vo->priv;
switch (request) { switch (request) {
case VOCTRL_FULLSCREEN:
vo_w32_fullscreen(vo);
resize_d3d(priv);
return VO_TRUE;
case VOCTRL_RESET:
return VO_NOTIMPL;
case VOCTRL_REDRAW_FRAME: case VOCTRL_REDRAW_FRAME:
d3d_draw_frame(priv); d3d_draw_frame(priv);
return VO_TRUE; return VO_TRUE;
@ -1331,15 +1325,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
return mp_csp_equalizer_get(&priv->video_eq, args->name, args->valueptr) return mp_csp_equalizer_get(&priv->video_eq, args->name, args->valueptr)
>= 0 ? VO_TRUE : VO_NOTIMPL; >= 0 ? VO_TRUE : VO_NOTIMPL;
} }
case VOCTRL_ONTOP:
vo_w32_ontop(vo);
return VO_TRUE;
case VOCTRL_BORDER:
vo_w32_border(vo);
return VO_TRUE;
case VOCTRL_UPDATE_SCREENINFO:
w32_update_xinerama_info(vo);
return VO_TRUE;
case VOCTRL_SET_PANSCAN: case VOCTRL_SET_PANSCAN:
calc_fs_rect(priv); calc_fs_rect(priv);
priv->vo->want_redraw = true; priv->vo->want_redraw = true;
@ -1355,7 +1340,17 @@ static int control(struct vo *vo, uint32_t request, void *data)
return !!args->out_image; return !!args->out_image;
} }
} }
return VO_NOTIMPL;
int events = 0;
int r = vo_w32_control(vo, &events, request, data);
if (events & VO_EVENT_RESIZE)
resize_d3d(priv);
if (events & VO_EVENT_EXPOSE)
vo->want_redraw = true;
return r;
} }
/** @brief libvo Callback: Configre the Direct3D adapter. /** @brief libvo Callback: Configre the Direct3D adapter.
@ -1444,20 +1439,6 @@ static void uninit(struct vo *vo)
priv->d3d9_dll = NULL; priv->d3d9_dll = NULL;
} }
/** @brief libvo Callback: Handles video window events.
*/
static void check_events(struct vo *vo)
{
d3d_priv *priv = vo->priv;
int flags = vo_w32_check_events(vo);
if (flags & VO_EVENT_RESIZE)
resize_d3d(priv);
if (flags & VO_EVENT_EXPOSE)
vo->want_redraw = true;
}
// Lock buffers and fill out to point to them. // Lock buffers and fill out to point to them.
// Must call d3d_unlock_video_objects() to unlock the buffers again. // Must call d3d_unlock_video_objects() to unlock the buffers again.
static bool get_video_buffer(d3d_priv *priv, struct mp_image *out) static bool get_video_buffer(d3d_priv *priv, struct mp_image *out)
@ -1827,7 +1808,6 @@ const struct vo_driver video_out_direct3d = {
.draw_image = draw_image, .draw_image = draw_image,
.draw_osd = draw_osd, .draw_osd = draw_osd,
.flip_page = flip_page, .flip_page = flip_page,
.check_events = check_events,
.uninit = uninit, .uninit = uninit,
}; };
@ -1845,6 +1825,5 @@ const struct vo_driver video_out_direct3d_shaders = {
.draw_image = draw_image, .draw_image = draw_image,
.draw_osd = draw_osd, .draw_osd = draw_osd,
.flip_page = flip_page, .flip_page = flip_page,
.check_events = check_events,
.uninit = uninit, .uninit = uninit,
}; };

View File

@ -336,7 +336,7 @@ static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p)
* vo_screenwidth * vo_screenwidth
* vo_screenheight * vo_screenheight
*/ */
void w32_update_xinerama_info(struct vo *vo) static void w32_update_xinerama_info(struct vo *vo)
{ {
struct vo_w32_state *w32 = vo->w32; struct vo_w32_state *w32 = vo->w32;
struct mp_vo_opts *opts = vo->opts; struct mp_vo_opts *opts = vo->opts;
@ -647,7 +647,7 @@ int vo_w32_init(struct vo *vo)
* event in addition or not. * event in addition or not.
*/ */
void vo_w32_fullscreen(struct vo *vo) static void vo_w32_fullscreen(struct vo *vo)
{ {
vo->opts->fs = !vo->opts->fs; vo->opts->fs = !vo->opts->fs;
reinit_window_state(vo); reinit_window_state(vo);
@ -658,7 +658,7 @@ void vo_w32_fullscreen(struct vo *vo)
* *
* Should be called on VOCTRL_BORDER event. * Should be called on VOCTRL_BORDER event.
*/ */
void vo_w32_border(struct vo *vo) static void vo_w32_border(struct vo *vo)
{ {
vo->opts->border = !vo->opts->border; vo->opts->border = !vo->opts->border;
reinit_window_state(vo); reinit_window_state(vo);
@ -669,7 +669,7 @@ void vo_w32_border(struct vo *vo)
* *
* Should be called on VOCTRL_ONTOP event. * Should be called on VOCTRL_ONTOP event.
*/ */
void vo_w32_ontop(struct vo *vo) static void vo_w32_ontop(struct vo *vo)
{ {
vo->opts->ontop = !vo->opts->ontop; vo->opts->ontop = !vo->opts->ontop;
reinit_window_state(vo); reinit_window_state(vo);

View File

@ -53,12 +53,8 @@ struct vo;
int vo_w32_init(struct vo *vo); int vo_w32_init(struct vo *vo);
void vo_w32_uninit(struct vo *vo); void vo_w32_uninit(struct vo *vo);
void vo_w32_ontop(struct vo *vo);
void vo_w32_border(struct vo *vo);
void vo_w32_fullscreen(struct vo *vo);
int vo_w32_control(struct vo *vo, int *events, int request, void *arg); int vo_w32_control(struct vo *vo, int *events, int request, void *arg);
int vo_w32_check_events(struct vo *vo); int vo_w32_check_events(struct vo *vo);
int vo_w32_config(struct vo *vo, uint32_t, uint32_t, uint32_t); int vo_w32_config(struct vo *vo, uint32_t, uint32_t, uint32_t);
void w32_update_xinerama_info(struct vo *vo);
#endif /* MPLAYER_W32_COMMON_H */ #endif /* MPLAYER_W32_COMMON_H */