From 0203ac5fa879e4a3243f42f14a1d99433be396ff Mon Sep 17 00:00:00 2001 From: "Chris \"koying\" Browet" Date: Fri, 16 Oct 2015 15:21:29 +0200 Subject: FIX: [droid] use context resolution when recreating window --- xbmc/Application.cpp | 16 +++++++++++----- xbmc/Application.h | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index d4e059dd10..8007c10a1d 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -826,10 +826,13 @@ bool CApplication::CreateGUI() return true; } -bool CApplication::InitWindow() +bool CApplication::InitWindow(RESOLUTION res) { - bool bFullScreen = CDisplaySettings::GetInstance().GetCurrentResolution() != RES_WINDOW; - if (!g_Windowing.CreateNewWindow(CSysInfo::GetAppName(), bFullScreen, CDisplaySettings::GetInstance().GetCurrentResolutionInfo(), OnEvent)) + if (res == RES_INVALID) + res = CDisplaySettings::GetInstance().GetCurrentResolution(); + + bool bFullScreen = res != RES_WINDOW; + if (!g_Windowing.CreateNewWindow(CSysInfo::GetAppName(), bFullScreen, CDisplaySettings::GetInstance().GetResolutionInfo(res), OnEvent)) { CLog::Log(LOGFATAL, "CApplication::Create: Unable to create window"); return false; @@ -841,7 +844,7 @@ bool CApplication::InitWindow() return false; } // set GUI res and force the clear of the screen - g_graphicsContext.SetVideoResolution(CDisplaySettings::GetInstance().GetCurrentResolution()); + g_graphicsContext.SetVideoResolution(res); return true; } @@ -2566,8 +2569,10 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) } break; +#ifdef TARGET_ANDROID case TMSG_DISPLAY_SETUP: - *static_cast(pMsg->lpVoid) = InitWindow(); + // We might come from a refresh rate switch destroying the native window; use the context resolution + *static_cast(pMsg->lpVoid) = InitWindow(g_graphicsContext.GetVideoResolution()); SetRenderGUI(true); break; @@ -2575,6 +2580,7 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) *static_cast(pMsg->lpVoid) = DestroyWindow(); SetRenderGUI(false); break; +#endif case TMSG_SETPVRMANAGERSTATE: if (pMsg->param1 != 0) diff --git a/xbmc/Application.h b/xbmc/Application.h index 58130a9ceb..2426795b18 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -24,6 +24,7 @@ #include "XBApplicationEx.h" #include "guilib/IMsgTargetCallback.h" +#include "guilib/Resolution.h" #include "utils/GlobalsHandling.h" #include "messaging/IMessageTarget.h" @@ -144,7 +145,7 @@ public: virtual bool Cleanup() override; bool CreateGUI(); - bool InitWindow(); + bool InitWindow(RESOLUTION res = RES_INVALID); bool DestroyWindow(); void StartServices(); void StopServices(); -- cgit v1.2.3