Switching between OS and CEGUI cursor (windowed mode)

I’m using the following snippet in my mouseMoved-Event to handle the switching between the windows os mouse cursor and the cegui mouse cursor when entering/leaving the RenderWindow.
if (mMouseInWindow)
{
CEGUI::System::getSingleton().injectMousePosition( arg.state.X.abs, arg.state.Y.abs );
[...]


linkboost