Skip to content

Commit

Permalink
fix for d3d fullscreen toggle (mpc-hc#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
adipose authored and clsid2 committed Dec 28, 2019
1 parent 4746efb commit 43d06b1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, bool bFullscreen, HRES
, m_VSyncMode(0)
, m_bDesktopCompositionDisabled(false)
, m_bIsFullscreen(bFullscreen)
, fullScreenChanged(false)
, m_bNeedCheckSample(true)
, m_MainThreadId(0)
, m_bIsRendering(false)
Expand Down Expand Up @@ -671,7 +672,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString& _Error)
}

HWND hFocusWindow = m_FocusThread->GetFocusWindow();
bTryToReset &= m_hFocusWindow == hFocusWindow;
bTryToReset &= (m_hFocusWindow == hFocusWindow || fullScreenChanged);
m_hFocusWindow = hFocusWindow;

if (m_pD3DEx) {
Expand Down Expand Up @@ -742,7 +743,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString& _Error)
pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}

bTryToReset &= m_hFocusWindow == m_hWnd;
bTryToReset &= (m_hFocusWindow == m_hWnd || fullScreenChanged);
m_hFocusWindow = m_hWnd;

if (m_pD3DEx) {
Expand Down Expand Up @@ -2260,6 +2261,7 @@ STDMETHODIMP CDX9AllocatorPresenter::SetPixelShader2(LPCSTR pSrcData, LPCSTR pTa

STDMETHODIMP CDX9AllocatorPresenter::SetD3DFullscreen(bool fEnabled)
{
fullScreenChanged = (fEnabled != m_bIsFullscreen);
m_bIsFullscreen = fEnabled;
return S_OK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace DSObjects
int m_OrderedPaint;
int m_VSyncMode;
bool m_bDesktopCompositionDisabled;
bool m_bIsFullscreen;
bool m_bIsFullscreen, fullScreenChanged;
bool m_bNeedCheckSample;
DWORD m_MainThreadId;

Expand Down
6 changes: 4 additions & 2 deletions src/filters/renderer/VideoRenderers/SyncRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ CBaseAP::CBaseAP(HWND hWnd, bool bFullscreen, HRESULT& hr, CString& _Error)
, m_bCompositionEnabled(false)
, m_bDesktopCompositionDisabled(false)
, m_bIsFullscreen(bFullscreen)
, fullScreenChanged(false)
, m_bNeedCheckSample(true)
, m_dMainThreadId(0)
, m_ScreenSize(0, 0)
Expand Down Expand Up @@ -516,7 +517,7 @@ HRESULT CBaseAP::CreateDXDevice(CString& _Error)
}

HWND hFocusWindow = m_FocusThread->GetFocusWindow();
bTryToReset &= m_hFocusWindow == hFocusWindow;
bTryToReset &= (m_hFocusWindow == hFocusWindow || fullScreenChanged);
m_hFocusWindow = hFocusWindow;

if (m_pD3DEx) {
Expand Down Expand Up @@ -588,7 +589,7 @@ HRESULT CBaseAP::CreateDXDevice(CString& _Error)
m_pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
}

bTryToReset &= m_hFocusWindow == m_hWnd;
bTryToReset &= (m_hFocusWindow == m_hWnd || fullScreenChanged);
m_hFocusWindow = m_hWnd;

if (m_pD3DEx) {
Expand Down Expand Up @@ -4615,6 +4616,7 @@ HRESULT CGenlock::UpdateStats(double syncOffset, double frameCycle)

STDMETHODIMP CSyncAP::SetD3DFullscreen(bool fEnabled)
{
fullScreenChanged = (fEnabled != m_bIsFullscreen);
m_bIsFullscreen = fEnabled;
return S_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion src/filters/renderer/VideoRenderers/SyncRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ namespace GothSync
bool m_bHighColorResolution;
bool m_bCompositionEnabled;
bool m_bDesktopCompositionDisabled;
bool m_bIsFullscreen;
bool m_bIsFullscreen, fullScreenChanged;
bool m_bNeedCheckSample;
DWORD m_dMainThreadId;

Expand Down
4 changes: 2 additions & 2 deletions src/mpc-hc/VMROSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ CVMROSD::CVMROSD(CMainFrame* pMainFrame)
m_colors[OSD_BACKGROUND] = CMPCTheme::ContentBGColor;
m_colors[OSD_BORDER] = CMPCTheme::WindowBorderColorDim;
m_colors[OSD_TEXT] = CMPCTheme::TextFGColor;
m_colors[OSD_BAR] = CMPCTheme::ContentBGColor;
m_colors[OSD_CURSOR] = CMPCTheme::TextFGColor;
m_colors[OSD_BAR] = CMPCTheme::ScrollBGColor;
m_colors[OSD_CURSOR] = CMPCTheme::ScrollThumbColor;
m_colors[OSD_DEBUGCLR] = CMPCTheme::DebugColorRed;
} else {
m_colors[OSD_TRANSPARENT] = RGB(0, 0, 0);
Expand Down

0 comments on commit 43d06b1

Please sign in to comment.