sphair/ClanLib — pull request #5 by authenticate (2013-09-09 00:51:31+00:00)
Title: OSX Changes

Hi all,

I was tinkering around with the OSX project and made some changes. I thought I would upload them so you could review and comment.

I was mainly trying to get the signals and slots to work for the mouse and keyboard. Currently, the events and callbacks almost work correctly. However, I ran into a problem where I had to comment out part of the "if" check in signal_v4.h:

```
void invoke(Param1 param1, Param2 param2, Param3 param3, Param4 param4) const
{
std::vector< std::shared_ptr > callbacks = impl->connected_slots;
std::vector< std::shared_ptr >::size_type i, size;
size = callbacks.size();
for (i = 0; i < size; i++)
if (/*callbacks[i]->valid &&*/ callbacks[i]->enabled)
((SlotCallback_v4 *) callbacks[i].get())->invoke(param1, param2, param3, param4);
}
```
I am not sure why the connected_slots are flagged as invalid. There's probably an error somewhere in my OSX implementation. They seem to work if you ignore the "valid" check. Hopefully, someone knows what would cause that.

The event data itself also needs some work.

The keyboard text data should be correct. However, the other values like ID and repeat count are wrong.
The mouse data has similar issues. The mouse button ID should be correct. However, values like position will not be correct at the moment.

The application window as a whole was unresponsive at first. I threaded the main call in applicationDidFinishLaunching so that function could return and give control back to the framework. Now, I don't know if that's the ideal solution. However, it fixed the unresponsiveness and I didn't notice and crazy concurrency problems (maybe they just haven't surfaced yet?). You can now resize the window and minimize it etc.

Let me know what you think. Honestly, a lot of this code probably needs reviewed and sanitized. I don't fully understand your code base very well. So, I was just looking at how the Windows version was implemented and pushing forward.

Thanks. Have a good one.