xbmc/xbmc — pull request #1246 by dedeibel (2012-08-05 12:23:45+00:00)
Title: #11861 XBMC loses video settings in windowed mode. Fix.

Hi,

I am trying to fix ticket #11861 since the problem is also a problem for me. This is my first change here, so please help me complying with your rules.

Please have a look at the ticket: http://trac.xbmc.org/ticket/11861

The fix is pretty simple, but there was more than one problem preventing the overscan settings to be restored.

First of all there was the following statement preventing the settings for windowed mode being loaded at all:

```C++
@@ -494,9 +496,6 @@ bool CSettings::LoadCalibration(const TiXmlElement* pRoot, const CStdString& str
// find this resolution in our resolution vector
for (unsigned int res = 0; res < m_ResInfo.size(); res++)
{
- if (res == RES_WINDOW)
- continue;
-
```

I don't know exactly where this came from, I kind of lost tracks on a merge back from some linux branch back in SVN, see below.

```
git log -1 45285e8
commit 45285e8a9300cd754a760560640b75b09f98035e
Author: AlTheKiller
Date: Wed Sep 23 01:49:50 2009 +0000

step 3/4: Move linuxport to trunk. How'd I get roped into this?

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23097 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
```

The second problem was matching the stored resolution nodes to the res info structures. This failed since the RES_WINDOW Structure did not have set the strMode field to "Windowed" at this time.

```C++
@@ -494,9 +496,6 @@ bool CSettings::LoadCalibration(const TiXmlElement* pRoot, const CStdString& str
// find this resolution in our resolution vector
for (unsigned int res = 0; res < m_ResInfo.size(); res++)
{
...
if (m_ResInfo[res].strMode == mode)
```

I fixed that by setting the strMode for windowed mode early in the constructor.

And finally the overscan settings where reset on every resolution change, including the initial setting. I overcame this by introducing a "reset overscan settings" flag with default to true to the method and additionally resetting the overscan values if the current settings don't make any sense.

Thanks for reading this and I hope this or a similar fix could make it into xbmc. I think some xbmc dev's comments would be helpfull.

regards,

Benjamin Peter