diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2016-09-19 18:25:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-19 18:25:40 +0200 |
commit | 0ffe92b1edc35df222c1a937e550f15b69f3d845 (patch) | |
tree | 21195b7d7d458bc00a8db4aeadb9ffa6005aa270 | |
parent | d4deb6296b2efecae84c6a4a701aecfea90efb05 (diff) | |
parent | 6b512c3d6fcf4624693a62470ef02024fb832cdc (diff) |
Merge pull request #10337 from marianob85/Ticket#16638
Ticket#16638 - No proper handling of WM_DISPLAYCHANGE and related events
-rw-r--r-- | xbmc/Application.cpp | 18 | ||||
-rw-r--r-- | xbmc/windowing/windows/WinEventsWin32.cpp | 20 | ||||
-rw-r--r-- | xbmc/windowing/windows/WinSystemWin32.cpp | 2 |
3 files changed, 31 insertions, 9 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 5f91cd4949..3e6c25ac7e 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -336,14 +336,16 @@ bool CApplication::OnEvent(XBMC_Event& newEvent) CApplicationMessenger::GetInstance().PostMsg(TMSG_QUIT); break; case XBMC_VIDEORESIZE: - if (g_windowManager.Initialized() && - !g_advancedSettings.m_fullScreen) + if (g_windowManager.Initialized()) { g_Windowing.SetWindowResolution(newEvent.resize.w, newEvent.resize.h); - g_graphicsContext.SetVideoResolution(RES_WINDOW, true); - CSettings::GetInstance().SetInt(CSettings::SETTING_WINDOW_WIDTH, newEvent.resize.w); - CSettings::GetInstance().SetInt(CSettings::SETTING_WINDOW_HEIGHT, newEvent.resize.h); - CSettings::GetInstance().Save(); + if (!g_advancedSettings.m_fullScreen) + { + g_graphicsContext.SetVideoResolution(RES_WINDOW, true); + CSettings::GetInstance().SetInt(CSettings::SETTING_WINDOW_WIDTH, newEvent.resize.w); + CSettings::GetInstance().SetInt(CSettings::SETTING_WINDOW_HEIGHT, newEvent.resize.h); + CSettings::GetInstance().Save(); + } } break; case XBMC_VIDEOMOVE: @@ -352,8 +354,8 @@ bool CApplication::OnEvent(XBMC_Event& newEvent) { // when fullscreen, remain fullscreen and resize to the dimensions of the new screen RESOLUTION newRes = (RESOLUTION) g_Windowing.DesktopResolution(g_Windowing.GetCurrentScreen()); - if (newRes != g_graphicsContext.GetVideoResolution()) - CDisplaySettings::GetInstance().SetCurrentResolution(newRes, true); + CDisplaySettings::GetInstance().SetCurrentResolution(newRes, true); + g_graphicsContext.SetVideoResolution(g_graphicsContext.GetVideoResolution(), true); } else #endif diff --git a/xbmc/windowing/windows/WinEventsWin32.cpp b/xbmc/windowing/windows/WinEventsWin32.cpp index b7f18e4b84..15f0fce275 100644 --- a/xbmc/windowing/windows/WinEventsWin32.cpp +++ b/xbmc/windowing/windows/WinEventsWin32.cpp @@ -667,6 +667,26 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L m_pEventFunc(newEvent); } return(0); + case WM_DISPLAYCHANGE: + CLog::Log(LOGDEBUG, __FUNCTION__": display change event"); + if (g_application.GetRenderGUI() && !g_Windowing.IsAlteringWindow() && GET_X_LPARAM(lParam) > 0 && GET_Y_LPARAM(lParam) > 0) + { + g_Windowing.UpdateResolutions(); + if (g_advancedSettings.m_fullScreen) + { + newEvent.type = XBMC_VIDEOMOVE; + newEvent.move.x = 0; + newEvent.move.y = 0; + } + else + { + newEvent.type = XBMC_VIDEORESIZE; + newEvent.resize.w = GET_X_LPARAM(lParam); + newEvent.resize.h = GET_Y_LPARAM(lParam); + } + m_pEventFunc(newEvent); + } + return(0); case WM_SIZE: newEvent.type = XBMC_VIDEORESIZE; newEvent.resize.w = GET_X_LPARAM(lParam); diff --git a/xbmc/windowing/windows/WinSystemWin32.cpp b/xbmc/windowing/windows/WinSystemWin32.cpp index d62abf1f6d..9d21a058a9 100644 --- a/xbmc/windowing/windows/WinSystemWin32.cpp +++ b/xbmc/windowing/windows/WinSystemWin32.cpp @@ -558,7 +558,7 @@ bool CWinSystemWin32::ChangeResolution(const RESOLUTION_INFO& res, bool forceCha void CWinSystemWin32::UpdateResolutions() { - + m_MonitorsInfo.clear(); CWinSystemBase::UpdateResolutions(); UpdateResolutionsInternal(); |