summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/decode/vd.c5
-rw-r--r--video/filter/vf_vo.c3
-rw-r--r--video/out/vo.c1
-rw-r--r--video/out/vo.h2
-rw-r--r--video/out/vo_sdl.c5
-rw-r--r--video/out/w32_common.c48
-rw-r--r--video/out/w32_common.h2
-rw-r--r--video/out/x11_common.c130
-rw-r--r--video/out/x11_common.h2
9 files changed, 8 insertions, 190 deletions
diff --git a/video/decode/vd.c b/video/decode/vd.c
index 99710f43d5..b43570f0ad 100644
--- a/video/decode/vd.c
+++ b/video/decode/vd.c
@@ -147,9 +147,8 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int out_fmt)
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ASPECT=%1.4f\n", sh->aspect);
}
- vocfg_flags = (opts->fullscreen ? VOFLAG_FULLSCREEN : 0)
- | (opts->vidmode ? VOFLAG_MODESWITCHING : 0)
- | (flip ? VOFLAG_FLIPPING : 0);
+ vocfg_flags = (opts->fullscreen ? VOFLAG_FULLSCREEN : 0) |
+ (flip ? VOFLAG_FLIPPING : 0);
// Time to config libvo!
mp_msg(MSGT_CPLAYER, MSGL_V,
diff --git a/video/filter/vf_vo.c b/video/filter/vf_vo.c
index bb29684b10..d8d00130d7 100644
--- a/video/filter/vf_vo.c
+++ b/video/filter/vf_vo.c
@@ -48,13 +48,12 @@ static int config(struct vf_instance *vf,
}
const vo_info_t *info = video_out->driver->info;
- mp_msg(MSGT_CPLAYER, MSGL_INFO, "VO: [%s] %dx%d => %dx%d %s %s%s%s\n",
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "VO: [%s] %dx%d => %dx%d %s %s%s\n",
info->short_name,
width, height,
d_width, d_height,
vo_format_name(outfmt),
(flags & VOFLAG_FULLSCREEN) ? " [fs]" : "",
- (flags & VOFLAG_MODESWITCHING) ? " [vm]" : "",
(flags & VOFLAG_FLIPPING) ? " [flip]" : "");
mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Description: %s\n", info->name);
mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Author: %s\n", info->author);
diff --git a/video/out/vo.c b/video/out/vo.c
index aa34f7704a..76c71518e6 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -50,7 +50,6 @@ int xinerama_x;
int xinerama_y;
int vo_nomouse_input = 0;
-int vo_grabpointer = 1;
int vo_vsync = 1;
int vo_fs = 0;
int vo_fsmode = 0;
diff --git a/video/out/vo.h b/video/out/vo.h
index f26ec1baff..50a30f82ea 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -118,7 +118,6 @@ typedef struct {
#define VO_NOTIMPL -3
#define VOFLAG_FULLSCREEN 0x01
-#define VOFLAG_MODESWITCHING 0x02
#define VOFLAG_FLIPPING 0x08
#define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
#define VOFLAG_STEREO 0x20 //< Use to create a stereo-capable window
@@ -308,7 +307,6 @@ extern const struct vo_driver *video_out_drivers[];
extern int xinerama_x;
extern int xinerama_y;
-extern int vo_grabpointer;
extern int vo_vsync;
extern int vo_fs;
extern int vo_fsmode;
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index e9967f37e5..99829aefa6 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -197,6 +197,7 @@ struct priv {
// options
int allow_sw;
+ int switch_mode;
};
static bool is_good_renderer(SDL_RendererInfo *ri,
@@ -370,11 +371,10 @@ static void check_resize(struct vo *vo)
static void set_fullscreen(struct vo *vo, int fs)
{
struct priv *vc = vo->priv;
- struct MPOpts *opts = vo->opts;
Uint32 fs_flags = 0;
if (fs) {
- if (opts->vidmode)
+ if (vc->switch_mode)
fs_flags |= SDL_WINDOW_FULLSCREEN;
else
fs_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
@@ -1036,6 +1036,7 @@ const struct vo_driver video_out_sdl = {
},
.options = (const struct m_option []){
OPT_FLAG("sw", allow_sw, 0),
+ OPT_FLAG("switch-mode", switch_mode, 0),
{NULL}
},
.preinit = preinit,
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 54620bdec6..ca3d8a7cc5 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -388,50 +388,6 @@ static void updateScreenProperties(struct vo *vo)
w32_update_xinerama_info(vo);
}
-static void changeMode(struct vo *vo)
-{
- struct vo_w32_state *w32 = vo->w32;
- DEVMODE dm;
- dm.dmSize = sizeof dm;
- dm.dmDriverExtra = 0;
-
- dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
- dm.dmBitsPerPel = w32->depthonscreen;
- dm.dmPelsWidth = vo->opts->vo_screenwidth;
- dm.dmPelsHeight = vo->opts->vo_screenheight;
-
- if (w32->vm) {
- int bestMode = -1;
- int bestScore = INT_MAX;
- int i;
- for (i = 0; EnumDisplaySettings(0, i, &dm); ++i) {
- int score = (dm.dmPelsWidth - w32->o_dwidth)
- * (dm.dmPelsHeight - w32->o_dheight);
- if (dm.dmBitsPerPel != w32->depthonscreen
- || dm.dmPelsWidth < w32->o_dwidth
- || dm.dmPelsHeight < w32->o_dheight)
- continue;
-
- if (score < bestScore) {
- bestScore = score;
- bestMode = i;
- }
- }
-
- if (bestMode != -1)
- EnumDisplaySettings(0, bestMode, &dm);
-
- ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
- }
-}
-
-static void resetMode(struct vo *vo)
-{
- struct vo_w32_state *w32 = vo->w32;
- if (w32->vm)
- ChangeDisplaySettings(0, 0);
-}
-
static DWORD update_style(struct vo *vo, DWORD style)
{
const DWORD NO_FRAME = WS_POPUP;
@@ -465,10 +421,8 @@ static int reinit_window_state(struct vo *vo)
// xxx not sure if this can trigger any unwanted messages (WM_MOVE/WM_SIZE)
if (vo_fs) {
- changeMode(vo);
while (ShowCursor(0) >= 0) /**/ ;
} else {
- resetMode(vo);
while (ShowCursor(1) < 0) /**/ ;
}
updateScreenProperties(vo);
@@ -594,7 +548,6 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height,
}
vo_fs = flags & VOFLAG_FULLSCREEN;
- w32->vm = flags & VOFLAG_MODESWITCHING;
return reinit_window_state(vo);
}
@@ -732,7 +685,6 @@ void vo_w32_uninit(struct vo *vo)
mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n");
if (!w32)
return;
- resetMode(vo);
ShowCursor(1);
DestroyWindow(w32->window);
UnregisterClassW(classname, 0);
diff --git a/video/out/w32_common.h b/video/out/w32_common.h
index 57997dd67b..63a7d19fc9 100644
--- a/video/out/w32_common.h
+++ b/video/out/w32_common.h
@@ -26,8 +26,6 @@
struct vo_w32_state {
HWND window;
- bool vm;
-
int depthonscreen;
// last non-fullscreen extends (updated only on fullscreen or on initialization)
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 3424d75cef..0514e88fef 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -133,8 +133,6 @@ static void saver_off(struct vo_x11_state *x11);
static void vo_x11_selectinput_witherr(Display *display, Window w,
long event_mask);
static void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer);
-static void vo_x11_vm_switch(struct vo *vo);
-static void vo_x11_vm_close(struct vo *vo);
static void vo_x11_create_colormap(struct vo_x11_state *x11,
XVisualInfo *vinfo);
@@ -627,7 +625,6 @@ void vo_x11_uninit(struct vo *vo)
struct vo_x11_state *x11 = vo->x11;
assert(x11);
- vo_x11_vm_close(vo);
saver_on(x11);
if (x11->window != None)
vo_showcursor(x11->display, x11->window);
@@ -1019,8 +1016,6 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
if (flags & VOFLAG_HIDDEN)
goto final;
if (x11->window_state & VOFLAG_HIDDEN) {
- if (flags & VOFLAG_MODESWITCHING)
- vo_x11_vm_switch(vo);
XSizeHints hint;
x11->window_state &= ~VOFLAG_HIDDEN;
vo_x11_classhint(vo, x11->window, classname);
@@ -1031,10 +1026,10 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
hint.width = width;
hint.height = height;
hint.flags = PSize;
- if (force_change_xy || x11->vm_set)
+ if (force_change_xy)
hint.flags |= PPosition;
XSetWMNormalHints(mDisplay, x11->window, &hint);
- if (!vo_border || x11->vm_set)
+ if (!vo_border)
vo_x11_decoration(vo, 0);
// map window
x11->xic = XCreateIC(x11->xim,
@@ -1063,14 +1058,6 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
vo->dwidth = vo->opts->vo_screenwidth;
vo->dheight = vo->opts->vo_screenheight;
}
- if (x11->vm_set) {
- /* Grab the mouse pointer in our window */
- if (vo_grabpointer) {
- XGrabPointer(x11->display, x11->window, True, 0, GrabModeAsync,
- GrabModeAsync, x11->window, None, CurrentTime);
- }
- XSetInputFocus(x11->display, x11->window, RevertToNone, CurrentTime);
- }
final:
if (x11->vo_gc != None)
XFreeGC(mDisplay, x11->vo_gc);
@@ -1490,108 +1477,6 @@ static void vo_x11_selectinput_witherr(Display *display, Window w,
}
#ifdef CONFIG_XF86VM
-static void vo_x11_vm_switch(struct vo *vo)
-{
- struct vo_x11_state *x11 = vo->x11;
- Display *mDisplay = x11->display;
- int vm_event, vm_error;
- int vm_ver, vm_rev;
- int have_vm = 0;
- int X = vo->dwidth, Y = vo->dheight;
- int modeline_width, modeline_height;
-
- if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) {
- XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
- mp_msg(MSGT_VO, MSGL_V, "XF86VidMode extension v%i.%i\n", vm_ver,
- vm_rev);
- have_vm = 1;
- } else {
- mp_msg(MSGT_VO, MSGL_WARN,
- "XF86VidMode extension not available.\n");
- }
-
- if (have_vm) {
- if (!x11->vm_orig_w) {
- int clock;
- XF86VidModeModeLine modeline;
- XF86VidModeGetModeLine(x11->display, x11->screen, &clock, &modeline);
- x11->vm_orig_w = modeline.hdisplay;
- x11->vm_orig_h = modeline.vdisplay;
- }
-
- int modecount = 0;
- XF86VidModeModeInfo **vidmodes = NULL;
- XF86VidModeGetAllModeLines(mDisplay, x11->screen, &modecount, &vidmodes);
- if (modecount == 0)
- return;
-
- int j = 0;
- modeline_width = vidmodes[0]->hdisplay;
- modeline_height = vidmodes[0]->vdisplay;
-
- for (int i = 1; i < modecount; i++) {
- if ((vidmodes[i]->hdisplay >= X)
- && (vidmodes[i]->vdisplay >= Y))
- {
- if ((vidmodes[i]->hdisplay <= modeline_width)
- && (vidmodes[i]->vdisplay <= modeline_height))
- {
- modeline_width = vidmodes[i]->hdisplay;
- modeline_height = vidmodes[i]->vdisplay;
- j = i;
- }
- }
- }
-
- mp_tmsg(MSGT_VO, MSGL_INFO, "XF86VM: Selected video mode %dx%d for image size %dx%d.\n",
- modeline_width, modeline_height, X, Y);
- XF86VidModeLockModeSwitch(mDisplay, x11->screen, 0);
- XF86VidModeSwitchToMode(mDisplay, x11->screen, vidmodes[j]);
-
- // FIXME: all this is more of a hack than proper solution
- // center the video if the screen has different size
- X = (x11->vm_orig_w - modeline_width) / 2;
- Y = (x11->vm_orig_h - modeline_height) / 2;
- XF86VidModeSetViewPort(mDisplay, x11->screen, X, Y);
- vo->dx = X;
- vo->dy = Y;
- vo->dwidth = modeline_width;
- vo->dheight = modeline_height;
- aspect_save_screenres(vo, modeline_width, modeline_height);
-
- x11->vm_set = 1;
- free(vidmodes);
- }
-}
-
-static void vo_x11_vm_close(struct vo *vo)
-{
- struct vo_x11_state *x11 = vo->x11;
- Display *dpy = x11->display;
- if (x11->vm_set) {
- int modecount = 0;
- XF86VidModeModeInfo **vidmodes = NULL;
- XF86VidModeModeInfo *mode = NULL;
-
- XF86VidModeGetAllModeLines(dpy, x11->screen, &modecount, &vidmodes);
- for (int i = 0; i < modecount; i++) {
- if ((vidmodes[i]->hdisplay == x11->vm_orig_w)
- && (vidmodes[i]->vdisplay == x11->vm_orig_h))
- {
- mp_msg(MSGT_VO, MSGL_INFO, "Returning to original mode %dx%d\n",
- x11->vm_orig_w, x11->vm_orig_h);
- mode = vidmodes[i];
- break;
- }
- }
-
- if (mode)
- XF86VidModeSwitchToMode(dpy, x11->screen, mode);
-
- free(vidmodes);
- }
-}
-
double vo_x11_vm_get_fps(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
@@ -1603,22 +1488,11 @@ double vo_x11_vm_get_fps(struct vo *vo)
XFree(modeline.private);
return 1e3 * clock / modeline.htotal / modeline.vtotal;
}
-
#else /* CONFIG_XF86VM */
-
-static void vo_x11_vm_switch(struct vo *vo)
-{
-}
-
-static void vo_x11_vm_close(struct vo *vo)
-{
-}
-
double vo_vm_get_fps(struct vo *vo)
{
return 0;
}
-
#endif
diff --git a/video/out/x11_common.h b/video/out/x11_common.h
index 71868cd11d..87067fc2a6 100644
--- a/video/out/x11_common.h
+++ b/video/out/x11_common.h
@@ -52,8 +52,6 @@ struct vo_x11_state {
int window_state;
int fs_flip;
int fs_layer;
- int vm_set;
- int vm_orig_w, vm_orig_h;
GC f_gc;
XSizeHints vo_hint;