mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Moved joystick initialization to happen *after* the construction of windows, to fix a deadlock happening on Windows at DLL loading
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1003 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
2f524481c1
commit
c3687b4018
@ -43,8 +43,8 @@ myWindow (NULL),
|
|||||||
myLastFrameTime (0.f),
|
myLastFrameTime (0.f),
|
||||||
myIsExternal (false),
|
myIsExternal (false),
|
||||||
myFramerateLimit(0),
|
myFramerateLimit(0),
|
||||||
mySetCursorPosX (-1),
|
mySetCursorPosX (0xFFFF),
|
||||||
mySetCursorPosY (-1)
|
mySetCursorPosY (0xFFFF)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -73,8 +73,8 @@ myWindow (NULL),
|
|||||||
myLastFrameTime (0.f),
|
myLastFrameTime (0.f),
|
||||||
myIsExternal (true),
|
myIsExternal (true),
|
||||||
myFramerateLimit(0),
|
myFramerateLimit(0),
|
||||||
mySetCursorPosX (-1),
|
mySetCursorPosX (0xFFFF),
|
||||||
mySetCursorPosY (-1)
|
mySetCursorPosY (0xFFFF)
|
||||||
{
|
{
|
||||||
Create(Handle, Params);
|
Create(Handle, Params);
|
||||||
}
|
}
|
||||||
@ -413,11 +413,12 @@ void Window::OnEvent(const Event& EventReceived)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Window::Initialize(priv::WindowImpl* Window)
|
void Window::Initialize(priv::WindowImpl* Window)
|
||||||
{
|
{
|
||||||
// Assign new window and listen to its events
|
// Assign and initialize the new window
|
||||||
myWindow = Window;
|
myWindow = Window;
|
||||||
myWindow->AddListener(this);
|
myWindow->Initialize();
|
||||||
|
|
||||||
// Attach input to the window
|
// Listen to events from the new window
|
||||||
|
myWindow->AddListener(this);
|
||||||
myWindow->AddListener(&myInput);
|
myWindow->AddListener(&myInput);
|
||||||
|
|
||||||
// Setup default behaviours (to get a consistent behaviour across different implementations)
|
// Setup default behaviours (to get a consistent behaviour across different implementations)
|
||||||
|
@ -88,12 +88,6 @@ myWidth (0),
|
|||||||
myHeight (0),
|
myHeight (0),
|
||||||
myJoyThreshold(0.1f)
|
myJoyThreshold(0.1f)
|
||||||
{
|
{
|
||||||
// Initialize the joysticks
|
|
||||||
for (unsigned int i = 0; i < JoysticksCount; ++i)
|
|
||||||
{
|
|
||||||
myJoysticks[i].Initialize(i);
|
|
||||||
myJoyStates[i] = myJoysticks[i].UpdateState();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +119,20 @@ void WindowImpl::RemoveListener(WindowListener* Listener)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// Initialize window's states that can't be done at construction
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void WindowImpl::Initialize()
|
||||||
|
{
|
||||||
|
// Initialize the joysticks
|
||||||
|
for (unsigned int i = 0; i < JoysticksCount; ++i)
|
||||||
|
{
|
||||||
|
myJoysticks[i].Initialize(i);
|
||||||
|
myJoyStates[i] = myJoysticks[i].UpdateState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the client width of the window
|
/// Get the client width of the window
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -108,6 +108,12 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void RemoveListener(WindowListener* Listener);
|
void RemoveListener(WindowListener* Listener);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// Initialize window's states that can't be done at construction
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void Initialize();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Get the client width of the window
|
/// Get the client width of the window
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user