Fixed Window::WaitEvent sometimes returning (false) when no event occurred
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1760 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
256e30bd27
commit
e9cccf0e6f
@ -115,8 +115,22 @@ bool WindowImpl::PopEvent(Event& event, bool block)
|
|||||||
// If the event queue is empty, let's first check if new events are available from the OS
|
// If the event queue is empty, let's first check if new events are available from the OS
|
||||||
if (myEvents.empty())
|
if (myEvents.empty())
|
||||||
{
|
{
|
||||||
|
// Special handling of joystick events (we must use polling)
|
||||||
ProcessJoystickEvents();
|
ProcessJoystickEvents();
|
||||||
ProcessEvents(block);
|
|
||||||
|
if (block)
|
||||||
|
{
|
||||||
|
// If we are blocking, loop until we actually received a SFML event
|
||||||
|
// (there may be OS events that make ProcessEvents(true) return, but
|
||||||
|
// which don't translate to SFML events)
|
||||||
|
while (myEvents.empty())
|
||||||
|
ProcessEvents(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If we are not blocking, just process the pending events
|
||||||
|
ProcessEvents(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop the first event of the queue, if it is not empty
|
// Pop the first event of the queue, if it is not empty
|
||||||
|
Loading…
Reference in New Issue
Block a user