summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-16 14:02:28 +0200
committerwm4 <wm4@nowhere>2013-05-26 16:44:19 +0200
commitd5de75b340a124e83aa1bc7c76ecbdfd0b7037df (patch)
treec863999a2be27a77cfa43d2892174ccf1c19d973 /video
parentbf10a4fdfa40cbe519e6ccb7fb895332da2021d1 (diff)
downloadmpv-d5de75b340a124e83aa1bc7c76ecbdfd0b7037df.tar.bz2
mpv-d5de75b340a124e83aa1bc7c76ecbdfd0b7037df.tar.xz
x11: use vo_x11_control() for all VOs
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_vdpau.c41
-rw-r--r--video/out/vo_x11.c27
-rw-r--r--video/out/vo_xv.c30
-rw-r--r--video/out/x11_common.c9
-rw-r--r--video/out/x11_common.h4
5 files changed, 31 insertions, 80 deletions
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index d1b838ff4d..d213b33c6f 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -867,20 +867,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
return 0;
}
-static void check_events(struct vo *vo)
-{
- if (handle_preemption(vo) < 0)
- return;
-
- int e = vo_x11_check_events(vo);
-
- if (e & VO_EVENT_RESIZE)
- resize(vo);
- else if (e & VO_EVENT_EXPOSE) {
- vo->want_redraw = true;
- }
-}
-
static struct bitmap_packer *make_packer(struct vo *vo, VdpRGBAFormat format)
{
struct vdpctx *vc = vo->priv;
@@ -1554,14 +1540,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
return true;
case VOCTRL_HWDEC_DECODER_RENDER:
return decoder_render(vo, data);
- case VOCTRL_BORDER:
- vo_x11_border(vo);
- checked_resize(vo);
- return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen(vo);
- checked_resize(vo);
- return VO_TRUE;
case VOCTRL_GET_PANSCAN:
return VO_TRUE;
case VOCTRL_SET_PANSCAN:
@@ -1585,12 +1563,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_GET_YUV_COLORSPACE:
*(struct mp_csp_details *)data = vc->colorspace;
return true;
- case VOCTRL_ONTOP:
- vo_x11_ontop(vo);
- return VO_TRUE;
- case VOCTRL_UPDATE_SCREENINFO:
- vo_x11_update_screeninfo(vo);
- return VO_TRUE;
case VOCTRL_NEWFRAME:
vc->deint_queue_pos = next_deint_queue_pos(vo, true);
if (status_ok(vo))
@@ -1617,7 +1589,17 @@ static int control(struct vo *vo, uint32_t request, void *data)
return true;
}
}
- return VO_NOTIMPL;
+
+ int events = 0;
+ int r = vo_x11_control(vo, &events, request, data);
+
+ if (events & VO_EVENT_RESIZE) {
+ checked_resize(vo);
+ } else if (events & VO_EVENT_EXPOSE) {
+ vo->want_redraw = true;
+ }
+
+ return r;
}
#define OPT_BASE_STRUCT struct vdpctx
@@ -1638,7 +1620,6 @@ const struct vo_driver video_out_vdpau = {
.get_buffered_frame = set_next_frame_info,
.draw_osd = draw_osd,
.flip_page_timed = flip_page_timed,
- .check_events = check_events,
.uninit = uninit,
.priv_size = sizeof(struct vdpctx),
.options = (const struct m_option []){
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c
index 973c6e49a9..845679c8f9 100644
--- a/video/out/vo_x11.c
+++ b/video/out/vo_x11.c
@@ -101,13 +101,6 @@ struct priv {
static bool resize(struct vo *vo);
-static void check_events(struct vo *vo)
-{
- int ret = vo_x11_check_events(vo);
- if (ret & (VO_EVENT_EXPOSE | VO_EVENT_RESIZE))
- resize(vo);
-}
-
/* Scan the available visuals on this Display/Screen. Try to find
* the 'best' available TrueColor visual that has a decent color
* depth (at least 15bit). If there are multiple visuals with depth
@@ -483,7 +476,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
ctx->Shm_Warned_Slow = 1;
}
usec_sleep(1000);
- check_events(vo);
+ vo_x11_check_events(vo);
}
}
#endif
@@ -646,10 +639,6 @@ static int preinit(struct vo *vo, const char *arg)
static int control(struct vo *vo, uint32_t request, void *data)
{
switch (request) {
- case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen(vo);
- resize(vo);
- return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
{
struct voctrl_set_equalizer_args *args = data;
@@ -660,12 +649,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
struct voctrl_get_equalizer_args *args = data;
return vo_x11_get_equalizer(vo, args->name, args->valueptr);
}
- case VOCTRL_ONTOP:
- vo_x11_ontop(vo);
- return VO_TRUE;
- case VOCTRL_UPDATE_SCREENINFO:
- vo_x11_update_screeninfo(vo);
- return VO_TRUE;
case VOCTRL_GET_PANSCAN:
return VO_TRUE;
case VOCTRL_SET_PANSCAN:
@@ -679,7 +662,12 @@ static int control(struct vo *vo, uint32_t request, void *data)
return true;
}
}
- return VO_NOTIMPL;
+
+ int events = 0;
+ int r = vo_x11_control(vo, &events, request, data);
+ if (events & (VO_EVENT_EXPOSE | VO_EVENT_RESIZE))
+ resize(vo);
+ return r;
}
const struct vo_driver video_out_x11 = {
@@ -698,6 +686,5 @@ const struct vo_driver video_out_x11 = {
.draw_image = draw_image,
.draw_osd = draw_osd,
.flip_page = flip_page,
- .check_events = check_events,
.uninit = uninit,
};
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index 8ae5a31a9a..d119125db4 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -657,16 +657,6 @@ static struct mp_image get_xv_buffer(struct vo *vo, int buf_index)
return img;
}
-static void check_events(struct vo *vo)
-{
- int e = vo_x11_check_events(vo);
-
- if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) {
- resize(vo);
- vo->want_redraw = true;
- }
-}
-
static void draw_osd(struct vo *vo, struct osd_state *osd)
{
struct xvctx *ctx = vo->priv;
@@ -696,7 +686,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
ctx->Shm_Warned_Slow = 1;
}
usec_sleep(1000);
- check_events(vo);
+ vo_x11_check_events(vo);
}
}
#endif
@@ -921,9 +911,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
switch (request) {
case VOCTRL_GET_PANSCAN:
return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen(vo);
- /* indended, fallthrough to update panscan on fullscreen/windowed switch */
case VOCTRL_SET_PANSCAN:
resize(vo);
return VO_TRUE;
@@ -948,12 +935,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
read_xv_csp(vo);
*cspc = ctx->cached_csp;
return true;
- case VOCTRL_ONTOP:
- vo_x11_ontop(vo);
- return VO_TRUE;
- case VOCTRL_UPDATE_SCREENINFO:
- vo_x11_update_screeninfo(vo);
- return VO_TRUE;
case VOCTRL_REDRAW_FRAME:
return redraw_frame(vo);
case VOCTRL_SCREENSHOT: {
@@ -962,7 +943,13 @@ static int control(struct vo *vo, uint32_t request, void *data)
return true;
}
}
- return VO_NOTIMPL;
+ int events = 0;
+ int r = vo_x11_control(vo, &events, request, data);
+ if (events & (VO_EVENT_EXPOSE | VO_EVENT_RESIZE)) {
+ resize(vo);
+ vo->want_redraw = true;
+ }
+ return r;
}
const struct vo_driver video_out_xv = {
@@ -974,6 +961,5 @@ const struct vo_driver video_out_xv = {
.draw_image = draw_image,
.draw_osd = draw_osd,
.flip_page = flip_page,
- .check_events = check_events,
.uninit = uninit
};
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index b9625879e8..b171605e2d 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -128,6 +128,7 @@ typedef struct
} MotifWmHints;
static void vo_x11_update_geometry(struct vo *vo);
+static void vo_x11_fullscreen(struct vo *vo);
static int vo_x11_get_fs_type(struct vo *vo);
static void xscreensaver_heartbeat(struct vo_x11_state *x11);
static void saver_on(struct vo_x11_state *x11);
@@ -371,7 +372,7 @@ static void init_atoms(struct vo_x11_state *x11)
x11->XA_NET_WM_CM = XInternAtom(x11->display, buf, False);
}
-void vo_x11_update_screeninfo(struct vo *vo)
+static void vo_x11_update_screeninfo(struct vo *vo)
{
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
@@ -1275,7 +1276,7 @@ static void vo_x11_update_geometry(struct vo *vo)
}
}
-void vo_x11_fullscreen(struct vo *vo)
+static void vo_x11_fullscreen(struct vo *vo)
{
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
@@ -1371,7 +1372,7 @@ void vo_x11_fullscreen(struct vo *vo)
x11->pos_changed_during_fs = false;
}
-void vo_x11_ontop(struct vo *vo)
+static void vo_x11_ontop(struct vo *vo)
{
struct mp_vo_opts *opts = vo->opts;
opts->ontop = !opts->ontop;
@@ -1379,7 +1380,7 @@ void vo_x11_ontop(struct vo *vo)
vo_x11_setlayer(vo, vo->x11->window, opts->ontop);
}
-void vo_x11_border(struct vo *vo)
+static void vo_x11_border(struct vo *vo)
{
vo->opts->border = !vo->opts->border;
vo_x11_decoration(vo, vo->opts->border && !vo->opts->fs);
diff --git a/video/out/x11_common.h b/video/out/x11_common.h
index 9766306f73..ec41f56b4f 100644
--- a/video/out/x11_common.h
+++ b/video/out/x11_common.h
@@ -129,7 +129,6 @@ struct vo_x11_state {
int vo_x11_init(struct vo *vo);
void vo_x11_uninit(struct vo *vo);
int vo_x11_check_events(struct vo *vo);
-void vo_x11_fullscreen(struct vo *vo);
uint32_t vo_x11_set_equalizer(struct vo *vo, const char *name, int value);
uint32_t vo_x11_get_equalizer(struct vo *vo, const char *name, int *value);
bool vo_x11_screen_is_composited(struct vo *vo);
@@ -140,9 +139,6 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis,
const char *classname);
void vo_x11_clear_background(struct vo *vo, const struct mp_rect *rc);
void vo_x11_clearwindow(struct vo *vo, Window vo_window);
-void vo_x11_ontop(struct vo *vo);
-void vo_x11_border(struct vo *vo);
-void vo_x11_update_screeninfo(struct vo *vo);
int vo_x11_control(struct vo *vo, int *events, int request, void *arg);
double vo_x11_vm_get_fps(struct vo *vo);