Improved SFML integration with Cocoa
This commit is contained in:
parent
d6a40cf062
commit
32563cdc6f
@ -109,12 +109,12 @@ PoolWrapper::~PoolWrapper()
|
|||||||
#ifdef SFML_DEBUG
|
#ifdef SFML_DEBUG
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
sf::Err() << "~PoolWrapper : count is less than zero! "
|
sf::Err() << "~PoolWrapper : count is less than zero! "
|
||||||
"You called ReleasePool from a thread too many times."
|
"You called ReleasePool from a thread too many times."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
} else if (count > 0) {
|
} else if (count > 0) {
|
||||||
sf::Err() << "~PoolWrapper : count is greater than zero! "
|
sf::Err() << "~PoolWrapper : count is greater than zero! "
|
||||||
"You called ReleasePool from a thread to few times."
|
"You called ReleasePool from a thread to few times."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
} else { // count == 0
|
} else { // count == 0
|
||||||
sf::Err() << "~PoolWrapper is HAPPY!" << std::endl;
|
sf::Err() << "~PoolWrapper is HAPPY!" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,17 @@
|
|||||||
#include <SFML/Window/OSX/HIDJoystickManager.hpp>
|
#include <SFML/Window/OSX/HIDJoystickManager.hpp>
|
||||||
#include <SFML/Window/OSX/HIDInputManager.hpp>
|
#include <SFML/Window/OSX/HIDInputManager.hpp>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Private data
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// Using a custom run loop mode solve some issues that appears when SFML
|
||||||
|
// is used with Cocoa.
|
||||||
|
CFStringRef const runLoopMode = CFSTR("SFML_RUN_LOOP_MODE");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
@ -74,7 +85,7 @@ HIDJoystickManager::HIDJoystickManager()
|
|||||||
|
|
||||||
IOHIDManagerScheduleWithRunLoop(myHIDManager,
|
IOHIDManagerScheduleWithRunLoop(myHIDManager,
|
||||||
CFRunLoopGetCurrent(),
|
CFRunLoopGetCurrent(),
|
||||||
kCFRunLoopDefaultMode);
|
runLoopMode);
|
||||||
|
|
||||||
IOHIDManagerOpen(myHIDManager, kIOHIDOptionsTypeNone);
|
IOHIDManagerOpen(myHIDManager, kIOHIDOptionsTypeNone);
|
||||||
}
|
}
|
||||||
@ -85,7 +96,7 @@ HIDJoystickManager::~HIDJoystickManager()
|
|||||||
{
|
{
|
||||||
IOHIDManagerUnscheduleFromRunLoop(myHIDManager,
|
IOHIDManagerUnscheduleFromRunLoop(myHIDManager,
|
||||||
CFRunLoopGetCurrent(),
|
CFRunLoopGetCurrent(),
|
||||||
kCFRunLoopDefaultMode);
|
runLoopMode);
|
||||||
|
|
||||||
IOHIDManagerRegisterDeviceMatchingCallback(myHIDManager, NULL, 0);
|
IOHIDManagerRegisterDeviceMatchingCallback(myHIDManager, NULL, 0);
|
||||||
IOHIDManagerRegisterDeviceRemovalCallback(myHIDManager, NULL, 0);
|
IOHIDManagerRegisterDeviceRemovalCallback(myHIDManager, NULL, 0);
|
||||||
@ -100,7 +111,7 @@ void HIDJoystickManager::Update()
|
|||||||
SInt32 status = kCFRunLoopRunHandledSource;
|
SInt32 status = kCFRunLoopRunHandledSource;
|
||||||
|
|
||||||
while (status == kCFRunLoopRunHandledSource) {
|
while (status == kCFRunLoopRunHandledSource) {
|
||||||
status = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
|
status = CFRunLoopRunInMode(runLoopMode, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user