Platform/Window: Fix SetCursor always changing cursor

This commit is contained in:
Lynix 2019-03-10 15:11:16 +01:00
parent e0d460eb95
commit 8c91d6a77d
2 changed files with 5 additions and 2 deletions

View File

@ -162,6 +162,7 @@ Nazara Engine:
- Added RigidBody2D::ForEachArbiter - Added RigidBody2D::ForEachArbiter
- Added possibility to change the RigidBody2D velocity function called by the physics engine - Added possibility to change the RigidBody2D velocity function called by the physics engine
- Fixed MouseButtonEvent and MouseMoveEvent mouse absolute position being unsigned (now signed) - Fixed MouseButtonEvent and MouseMoveEvent mouse absolute position being unsigned (now signed)
- Fixed Window::SetCursor changing cursor even if window was in foreground on Windows
Nazara Development Kit: Nazara Development Kit:
- Added ImageWidget (#139) - Added ImageWidget (#139)

View File

@ -289,7 +289,9 @@ namespace Nz
{ {
m_cursor = cursor.m_impl->GetCursor(); m_cursor = cursor.m_impl->GetCursor();
::SetCursor(m_cursor); // Applies cursor only if we have focus
if (GetForegroundWindow() == m_handle)
::SetCursor(m_cursor);
} }
void WindowImpl::SetEventListener(bool listener) void WindowImpl::SetEventListener(bool listener)
@ -653,7 +655,7 @@ namespace Nz
{ {
m_mouseInside = true; m_mouseInside = true;
// On créé un évènement pour être informé de la sortie de la fenêtre // Track mouse event to be notified when mouse leaves window
TRACKMOUSEEVENT mouseEvent; TRACKMOUSEEVENT mouseEvent;
mouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); mouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
mouseEvent.dwFlags = TME_LEAVE; mouseEvent.dwFlags = TME_LEAVE;