Add mouse grab support.

Author: Alfred Krohmer
Origin of the patch:
http://sourceforge.net/tracker/?func=detail&aid=2671880&group_id=149835&atid=775955
http://www.wreckedgames.com/forum/index.php?topic=1104.0
Fix Win32Mouse::setPosition to use correct position.

The GetWindowRect is returning the full window rect with border
and titlebar, which adds an extra offset.
The GetClientRect would be correct, but ClientToScreen is cleaner.
Only update abs position if its inside of the window.

Normally the non-exclusive mode is used for GUI,
like a typical widget based window.
So the user should feel the mouse is released,
when the mouse is outside of the window.
Fix Mouse::Hide for Win32.

The ShowCursor function works quiet tricky.
There is a counter, which is initialized to 0.
if counter >= 0 the cursor is visible.
if counter <= -1 the cursor is hidden.
ShowCursor(true) increments and ShowCursor(false) decrements the counter.
When entering grab, the counter will decrement by 2,
When leaving grab the counter will increment by 2.
So cursor will only be visible in grab(false) mode.
Allow to set position in grabbed mode.
Set bootstrap as executable.

Maybe a git-svn bug.
Remove separated grab for keyboard.

It just don't makes sense to use keyboard grab without mouse grab.
Using mouse grab without keyboard grab will lock up the mouse forever.

Also I have renamed _setGrabState to  _setKeyboardGrabState to prevent confusion.
It will not set mouse grab, but only the keyboard grab.
Fix bug in destructor, which can cause crash.
Implement window focus handling and fix bug in grab switching.

If the window hasn't got focus, then it should ungrab keyboard,
but grab if receiving focus again.
The old implementation was not working if dynamically switching.
For example if the keyboard is grabbed and setting grabKeyboard=false,
it will never release grab with alt+tab and the user is trapped!
I have also renamed mGrabKeyboard, because there are lot of stack grab
variables and its confusing.
I have checked all situations with truth table for verification:
a=grab; b=hasFocus; c=mGrabKeyboard; d=needGrabSwitch;
abc|d
001|0
001|1
010|0
011|1
100|0
101|1
110|1
111|0
With karnaugh table optimization:
d=~a*c+~b*c+a*b*~c=c*(~a+~b)+~c*a*b
Handle mouse position, when the cursor enters/leaves.

If the user switches the window with alt+tab back,
then the position is not updated.
Also the LeaveNotify's cursor is nearer to the corner.
Also replaced multiple if to switch, which is cleaner and faster.
if not grabbed, make mouse position absolute.

Also prevent duplicate event for the same position.
Also move clipping out, so that mouse is always clipped.
Only grab mouse, if it has focus.

For example if the window is created, but ois is not initialized and
the user switches to another app, then the whole system gets locked.
Also do not set mouse position. If there is a full screen foreground
window, it will not get inside OIS window, so its not always working.
Implement setPosition in grabbed mode.
Hide mouse when grabbed.

It don't makes sense to show the mouse, because it is wrapped.
Also this is the forced behavior on windows,
so this makes it to behave the same way as on windows.
Separate implementation and user requested grab.

The problem is that implementation is setting hide and grab lot of times, but then the user requested mode is lost and it will never be the requested again.
With separation, the user requested mode will not be lost.
Fix window focus grab handling in mouse.

It was not handling all situations.
It was not setting grab back to user requested mode.
Fix the order.
Disallow to set position, when we have lost focus.
Update old position when warping.

This is to make sure that the relative value on the next movement is
correct.
Fix issue warping when grabbed issue.