Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[win32] fix crash after #13722 + cosmetics #13728

Merged
merged 3 commits into from Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion xbmc/utils/CPUInfo.cpp
Expand Up @@ -761,8 +761,8 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice,
}
}
else
#endif // TARGET_WINDOWS_STORE
return false;
#endif // TARGET_WINDOWS_STORE
#elif defined(TARGET_FREEBSD)
long *cptimes;
size_t len;
Expand Down
12 changes: 8 additions & 4 deletions xbmc/windowing/windows/WinEventsWin32.cpp
Expand Up @@ -131,7 +131,7 @@ static int XBMC_MapVirtualKey(int scancode, WPARAM vkey)
case VK_LAUNCH_MEDIA_SELECT:
case VK_LAUNCH_APP1:
case VK_LAUNCH_APP2:
return vkey;
return static_cast<int>(vkey);
default:;
}
switch (mvke)
Expand All @@ -149,7 +149,7 @@ static int XBMC_MapVirtualKey(int scancode, WPARAM vkey)
case VK_PRIOR: return EXTKEYPAD(VK_NUMPAD9);
default:;
}
return mvke ? mvke : vkey;
return mvke ? mvke : static_cast<int>(vkey);
}


Expand Down Expand Up @@ -184,7 +184,7 @@ static XBMC_keysym *TranslateKey(WPARAM vkey, UINT scancode, XBMC_keysym *keysym
* so we handle it as a special case here */
if ((keystate[VK_NUMLOCK] & 1) && vkey >= VK_NUMPAD0 && vkey <= VK_NUMPAD9)
{
keysym->unicode = vkey - VK_NUMPAD0 + '0';
keysym->unicode = static_cast<uint16_t>(vkey - VK_NUMPAD0 + '0');
}
else if (ToUnicode(static_cast<UINT>(vkey), scancode, keystate, reinterpret_cast<LPWSTR>(wchars), ARRAY_SIZE(wchars), 0) > 0)
{
Expand Down Expand Up @@ -762,9 +762,13 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
break;
}
case WM_PAINT:
{
//some other app has painted over our window, mark everything as dirty
CServiceBroker::GetGUI()->GetWindowManager().MarkDirty();
CGUIComponent* component = CServiceBroker::GetGUI();
if (component)
component->GetWindowManager().MarkDirty();
break;
}
case BONJOUR_EVENT:
CZeroconf::GetInstance()->ProcessResults();
break;
Expand Down
12 changes: 6 additions & 6 deletions xbmc/windowing/windows/WinSystemWin32.cpp
Expand Up @@ -189,11 +189,11 @@ bool CWinSystemWin32::CreateNewWindow(const std::string& name, bool fullScreen,

m_inFocus = true;

const DWORD dwHwndTabletProperty =
DWORD dwHwndTabletProperty =
TABLET_DISABLE_PENBARRELFEEDBACK | // disables UI feedback on pen button down (circle)
TABLET_DISABLE_FLICKS; // disables pen flicks (back, forward, drag down, drag up)

SetProp(hWnd, MICROSOFT_TABLETPENSERVICE_PROPERTY, reinterpret_cast<HANDLE>(dwHwndTabletProperty));
SetProp(hWnd, MICROSOFT_TABLETPENSERVICE_PROPERTY, &dwHwndTabletProperty);

m_hWnd = hWnd;
m_bWindowCreated = true;
Expand Down Expand Up @@ -235,9 +235,9 @@ bool CWinSystemWin32::CreateBlankWindows()
}

// We need as many blank windows as there are screens (minus 1)
int BlankWindowsCount = m_MonitorsInfo.size() -1;
size_t BlankWindowsCount = m_MonitorsInfo.size() - 1;

for (int i=0; i < BlankWindowsCount; i++)
for (size_t i = 0; i < BlankWindowsCount; i++)
{
HWND hBlankWindow = CreateWindowEx(WS_EX_TOPMOST, L"BlankWindowClass", L"", WS_POPUP | WS_DISABLED,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr, nullptr, nullptr, nullptr);
Expand Down Expand Up @@ -927,7 +927,7 @@ bool CWinSystemWin32::UpdateResolutionsInternal()

// Careful, some adapters don't end up in the vector (mirroring, no active output, etc.)
if (ddAdapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
m_nPrimary = m_MonitorsInfo.size() -1;
m_nPrimary = static_cast<int>(m_MonitorsInfo.size()) - 1;

}
}
Expand Down Expand Up @@ -1071,7 +1071,7 @@ void CWinSystemWin32::SetForegroundWindowInternal(HWND hWnd)

if (dwThisTID != dwCurrTID)
{
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, reinterpret_cast<PVOID>(lockTimeOut), SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, &lockTimeOut, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
}
}
Expand Down
6 changes: 5 additions & 1 deletion xbmc/windowing/windows/WinSystemWin32.h
Expand Up @@ -163,6 +163,10 @@ DECLARE_HANDLE(HGESTUREINFO);

#endif

#ifdef IsMinimized
#undef IsMinimized
#endif

class CWinSystemWin32 : public CWinSystemBase
{
public:
Expand All @@ -177,7 +181,7 @@ class CWinSystemWin32 : public CWinSystemBase
void UpdateResolutions() override;
bool CenterWindow() override;
virtual void NotifyAppFocusChange(bool bGaining) override;
int GetNumScreens() override { return m_MonitorsInfo.size(); };
int GetNumScreens() override { return static_cast<int>(m_MonitorsInfo.size()); };
int GetCurrentScreen() override;
void ShowOSMouse(bool show) override;
bool HasInertialGestures() override { return true; }//if win32 has touchscreen - it uses the win32 gesture api for inertial scrolling
Expand Down
4 changes: 2 additions & 2 deletions xbmc/windowing/windows/WinSystemWin32DX.cpp
Expand Up @@ -194,7 +194,7 @@ void CWinSystemWin32DX::OnResize(int width, int height)
if (!m_IsAlteringWindow)
ReleaseBackBuffer();

m_deviceResources->SetLogicalSize(width, height);
m_deviceResources->SetLogicalSize(static_cast<float>(width), static_cast<float>(height));

if (!m_IsAlteringWindow)
CreateBackBuffer();
Expand Down Expand Up @@ -330,7 +330,7 @@ void CWinSystemWin32DX::FixRefreshRateIfNecessary(const D3D10DDIARG_CREATERESOUR
refreshRate /= 2;

uint32_t refreshNum, refreshDen;
DX::GetRefreshRatio(floor(m_fRefreshRate), &refreshNum, &refreshDen);
DX::GetRefreshRatio(static_cast<uint32_t>(floor(m_fRefreshRate)), &refreshNum, &refreshDen);
float diff = fabs(refreshRate - static_cast<float>(refreshNum) / static_cast<float>(refreshDen)) / refreshRate;
CLog::LogF(LOGDEBUG, "refreshRate: %0.4f, desired: %0.4f, deviation: %.5f, fixRequired: %s, %d",
refreshRate, m_fRefreshRate, diff, (diff > 0.0005 && diff < 0.1) ? "yes" : "no", pResource->pPrimaryDesc->Flags);
Expand Down