Changed: Windows focus events in Direct3d

feature/pre-code-move
Nimetu 5 years ago
parent 0bec2ee2ff
commit dccbb376a0

@ -197,6 +197,7 @@ CDriverD3D::CDriverD3D()
_BackBuffer = NULL;
_Maximized = false;
_HandlePossibleSizeChangeNextSize = false;
_WindowFocus = true;
_Interval = 1;
_AGPMemoryAllocated = 0;
_VRAMMemoryAllocated = 0;
@ -1164,6 +1165,14 @@ void D3DWndProc(CDriverD3D *driver, HWND hWnd, UINT message, WPARAM wParam, LPAR
}
}
if ((message == WM_SETFOCUS) || (message == WM_KILLFOCUS))
{
if (driver != NULL)
{
driver->_WindowFocus = (message == WM_SETFOCUS);
}
}
if (driver->_EventEmitter.getNumEmitters() > 0)
{
CWinEventEmitter *we = NLMISC::safe_cast<CWinEventEmitter *>(driver->_EventEmitter.getEmitter(0));
@ -1370,6 +1379,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
// Reset window state
_Maximized = false;
_HandlePossibleSizeChangeNextSize = false;
_WindowFocus = true;
if (_HWnd)
{

@ -2324,6 +2324,7 @@ private:
sint32 _WindowY;
bool _DestroyWindow;
bool _Maximized;
bool _WindowFocus;
bool _HandlePossibleSizeChangeNextSize;
GfxMode _CurrentMode;
uint _Interval;

@ -374,7 +374,7 @@ void CDriverD3D::setMousePos(float x, float y)
{
H_AUTO_D3D(CDriverD3D_setMousePos);
if (_HWnd == EmptyWindow)
if (_HWnd == EmptyWindow || !_WindowFocus)
return;
// convert position size from float to pixels

Loading…
Cancel
Save