Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Don't MoveVideoWindow() during fullscreen toggle
Browse files Browse the repository at this point in the history
Refs #4004
  • Loading branch information
alexmarsev committed Mar 3, 2014
1 parent 3f4639f commit 7c6a1ce
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
29 changes: 27 additions & 2 deletions src/mpc-hc/ChildView.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
* (C) 2006-2013 see Authors.txt
* (C) 2006-2014 see Authors.txt
*
* This file is part of MPC-HC.
*
Expand Down Expand Up @@ -28,14 +28,37 @@ CChildView::CChildView(CMainFrame* pMainFrame)
: m_vrect(0, 0, 0, 0)
, CMouseWnd(pMainFrame)
, m_pMainFrame(pMainFrame)
, m_bSwitchingFullscreen(false)
{
LoadLogo();
GetEventd().Connect(m_eventc, {
MpcEvent::SWITCHING_TO_FULLSCREEN,
MpcEvent::SWITCHED_TO_FULLSCREEN,
MpcEvent::SWITCHING_FROM_FULLSCREEN,
MpcEvent::SWITCHED_FROM_FULLSCREEN,
}, std::bind(&CChildView::EventCallback, this, std::placeholders::_1));
}

CChildView::~CChildView()
{
}

void CChildView::EventCallback(MpcEvent ev)
{
switch (ev) {
case MpcEvent::SWITCHING_TO_FULLSCREEN:
case MpcEvent::SWITCHING_FROM_FULLSCREEN:
m_bSwitchingFullscreen = true;
break;
case MpcEvent::SWITCHED_TO_FULLSCREEN:
case MpcEvent::SWITCHED_FROM_FULLSCREEN:
m_bSwitchingFullscreen = false;
break;
default:
ASSERT(FALSE);
}
}

BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs)) {
Expand Down Expand Up @@ -168,7 +191,9 @@ BOOL CChildView::OnEraseBkgnd(CDC* pDC)
void CChildView::OnSize(UINT nType, int cx, int cy)
{
__super::OnSize(nType, cx, cy);
m_pMainFrame->MoveVideoWindow();
if (!m_bSwitchingFullscreen) {
m_pMainFrame->MoveVideoWindow();
}
}

LRESULT CChildView::OnNcHitTest(CPoint point)
Expand Down
8 changes: 7 additions & 1 deletion src/mpc-hc/ChildView.h
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
* (C) 2006-2013 see Authors.txt
* (C) 2006-2014 see Authors.txt
*
* This file is part of MPC-HC.
*
Expand Down Expand Up @@ -32,6 +32,12 @@ class CChildView : public CMouseWnd

CMainFrame* m_pMainFrame;

bool m_bSwitchingFullscreen;

EventClient m_eventc;

void EventCallback(MpcEvent ev);

public:
CChildView(CMainFrame* pMainFrm);
virtual ~CChildView();
Expand Down
2 changes: 2 additions & 0 deletions src/mpc-hc/EventDispatcher.h
Expand Up @@ -29,6 +29,8 @@ enum class MpcEvent
{
SWITCHING_TO_FULLSCREEN,
SWITCHED_TO_FULLSCREEN,
SWITCHING_FROM_FULLSCREEN,
SWITCHED_FROM_FULLSCREEN,
SWITCHING_TO_FULLSCREEN_D3D,
SWITCHED_TO_FULLSCREEN_D3D,
MEDIA_LOADED,
Expand Down
11 changes: 6 additions & 5 deletions src/mpc-hc/MainFrm.cpp
Expand Up @@ -761,12 +761,11 @@ CMainFrame::CMainFrame()
EventRouter::EventSelection fires;
fires.insert(MpcEvent::SWITCHING_TO_FULLSCREEN);
fires.insert(MpcEvent::SWITCHED_TO_FULLSCREEN);
fires.insert(MpcEvent::SWITCHING_FROM_FULLSCREEN);
fires.insert(MpcEvent::SWITCHED_FROM_FULLSCREEN);
fires.insert(MpcEvent::SWITCHING_TO_FULLSCREEN_D3D);
fires.insert(MpcEvent::SWITCHED_TO_FULLSCREEN_D3D);
fires.insert(MpcEvent::MEDIA_LOADED);
fires.insert(MpcEvent::SHADER_PRERESIZE_SELECTION_CHANGED);
fires.insert(MpcEvent::SHADER_POSTRESIZE_SELECTION_CHANGED);
fires.insert(MpcEvent::SHADER_SELECTION_CHANGED);
fires.insert(MpcEvent::DISPLAY_MODE_AUTOCHANGING);
fires.insert(MpcEvent::DISPLAY_MODE_AUTOCHANGED);
fires.insert(MpcEvent::CONTEXT_MENU_POPUP_INITIALIZED);
Expand Down Expand Up @@ -9324,6 +9323,8 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT
}
SetMenuBarVisibility(AFX_MBV_DISPLAYONFOCUS | AFX_MBV_DISPLAYONF10);
} else {
m_eventc.FireEvent(MpcEvent::SWITCHING_FROM_FULLSCREEN);

if (s.AutoChangeFullscrRes.bEnabled && s.AutoChangeFullscrRes.bApplyDefault && s.AutoChangeFullscrRes.dmFullscreenRes[0].fChecked == 1) {
SetDispMode(s.strFullScreenMonitor, s.AutoChangeFullscrRes.dmFullscreenRes[0].dmFSRes);
}
Expand Down Expand Up @@ -9429,6 +9430,8 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT

if (m_fFullScreen) {
m_eventc.FireEvent(MpcEvent::SWITCHED_TO_FULLSCREEN);
} else {
m_eventc.FireEvent(MpcEvent::SWITCHED_FROM_FULLSCREEN);
}
}

Expand Down Expand Up @@ -9886,8 +9889,6 @@ void CMainFrame::ZoomVideoWindow(bool snap/* = true*/, double scale/* = ZOOM_DEF
if ((m_fFullScreen || !s.HasFixedWindowSize()) && !IsD3DFullScreenMode()) {
MoveWindow(r);
}

MoveVideoWindow();
}

double CMainFrame::GetZoomAutoFitScale(bool bLargerOnly)
Expand Down

0 comments on commit 7c6a1ce

Please sign in to comment.