summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-18 14:05:39 +0200
committerwm4 <wm4@nowhere>2013-07-18 14:07:21 +0200
commitc4b08a9a1149a83d7374eaea9863dd4c7cbd12d7 (patch)
tree46dbfc1850b7166948b4447332a20edefcedc779 /video/out/w32_common.c
parent05cf512dc56aab1aaf12884e44065cf2fc03c11e (diff)
downloadmpv-c4b08a9a1149a83d7374eaea9863dd4c7cbd12d7.tar.bz2
mpv-c4b08a9a1149a83d7374eaea9863dd4c7cbd12d7.tar.xz
video: remove fullscreen flags chaos
There was a MPOpts fullscreen field, a mp_vo_opts.fs field, and VOFLAG_FULLSCREEN. Remove all these and introduce a mp_vo_opts.fullscreen flag instead. When VOs receive VOCTRL_FULLSCREEN, they are supposed to set the current fullscreen mode to the state in mp_vo_opts.fullscreen. They also should do this implicitly on config(). VOs which are capable of doing so can update the mp_vo_opts.fullscreen if the actual fullscreen mode changes (e.g. if the user uses the window manager controls). If fullscreen mode switching fails, they can also set mp_vo_opts.fullscreen to the actual state. Note that the X11 backend does almost none of this, and it has a private fs flag to store the fullscreen flag, instead of getting it from the WM. (Possibly because it has to deal with broken WMs.) The fullscreen option has to be checked on config() to deal with the -fs option, especially with something like: mpv --fs file1.mkv --{ --no-fs file2.mkv --} (It should start in fullscreen mode, but go to windowed mode when playing file2.mkv.) Wayland changes by: Alexander Preisinger <alexander.preisinger@gmail.com> Cocoa changes by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index b5aa899333..69a98e94ed 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -152,7 +152,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
break;
}
case WM_SIZING:
- if (vo->opts->keepaspect && !vo->opts->fs && vo->opts->WinID < 0) {
+ if (vo->opts->keepaspect && !vo->opts->fullscreen &&
+ vo->opts->WinID < 0)
+ {
RECT *rc = (RECT*)lParam;
// get client area of the windows if it had the rect rc
// (subtracting the window borders)
@@ -260,7 +262,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
int y = GET_Y_LPARAM(lParam);
mouse_button |= mod_state(vo);
if (mouse_button == (MP_MOUSE_BTN0 | MP_KEY_STATE_DOWN) &&
- !vo->opts->fs && !mp_input_test_dragging(vo->input_ctx, x, y))
+ !vo->opts->fullscreen && !mp_input_test_dragging(vo->input_ctx, x, y))
{
// Window dragging hack
ReleaseCapture();
@@ -353,9 +355,9 @@ static void w32_update_xinerama_info(struct vo *vo)
{
struct vo_w32_state *w32 = vo->w32;
struct mp_vo_opts *opts = vo->opts;
- int screen = opts->fs ? opts->fsscreen_id : opts->screen_id;
+ int screen = opts->fullscreen ? opts->fsscreen_id : opts->screen_id;
vo->xinerama_x = vo->xinerama_y = 0;
- if (opts->fs && screen == -2) {
+ if (opts->fullscreen && screen == -2) {
int tmp;
vo->xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
vo->xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
@@ -403,7 +405,7 @@ static DWORD update_style(struct vo *vo, DWORD style)
const DWORD NO_FRAME = WS_POPUP;
const DWORD FRAME = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
style &= ~(NO_FRAME | FRAME);
- style |= (vo->opts->border && !vo->opts->fs) ? FRAME : NO_FRAME;
+ style |= (vo->opts->border && !vo->opts->fullscreen) ? FRAME : NO_FRAME;
return style;
}
@@ -417,18 +419,18 @@ static int reinit_window_state(struct vo *vo)
if (vo->opts->WinID >= 0)
return 1;
- bool toggle_fs = w32->current_fs != vo->opts->fs;
- w32->current_fs = vo->opts->fs;
+ bool toggle_fs = w32->current_fs != vo->opts->fullscreen;
+ w32->current_fs = vo->opts->fullscreen;
DWORD style = update_style(vo, GetWindowLong(w32->window, GWL_STYLE));
- if (vo->opts->fs || vo->opts->ontop)
+ if (vo->opts->fullscreen || vo->opts->ontop)
layer = HWND_TOPMOST;
// xxx not sure if this can trigger any unwanted messages (WM_MOVE/WM_SIZE)
updateScreenProperties(vo);
- if (vo->opts->fs) {
+ if (vo->opts->fullscreen) {
// Save window position and size when switching to fullscreen.
if (toggle_fs) {
w32->prev_width = vo->dwidth;
@@ -554,7 +556,6 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height,
vo->dheight = r.bottom;
}
- vo->opts->fs = flags & VOFLAG_FULLSCREEN;
return reinit_window_state(vo);
}
@@ -651,8 +652,8 @@ int vo_w32_init(struct vo *vo)
static void vo_w32_fullscreen(struct vo *vo)
{
- vo->opts->fs = !vo->opts->fs;
- reinit_window_state(vo);
+ if (vo->opts->fullscreen != vo->w32->current_fs)
+ reinit_window_state(vo);
}
/**