Hide mouse when it leaves the display

This commit is contained in:
David Capello 2014-04-25 08:58:19 -03:00
parent 95fbfd9fe7
commit af299eecc8
3 changed files with 35 additions and 2 deletions

View File

@ -462,6 +462,23 @@ void Manager::generateMessagesFromSheEvents()
break;
}
case she::Event::MouseEnter: {
if (!mouse_events_from_she)
continue;
jmouse_set_cursor(kArrowCursor);
break;
}
case she::Event::MouseLeave: {
if (!mouse_events_from_she)
continue;
jmouse_set_cursor(kNoCursor);
setMouse(NULL);
break;
}
case she::Event::MouseMove: {
if (!mouse_events_from_she)
continue;

View File

@ -242,11 +242,26 @@ bool jmouse_poll()
return false;
}
void _internal_no_mouse_position()
{
moved = true;
m_x[1] = -1;
m_y[1] = -1;
m_x[0] = -1;
m_y[0] = -1;
}
void _internal_set_mouse_position(const gfx::Point& newPos)
{
moved = true;
m_x[1] = m_x[0];
m_y[1] = m_y[0];
if (m_x[0] >= 0) {
m_x[1] = m_x[0];
m_y[1] = m_y[0];
}
else {
m_x[1] = newPos.x;
m_y[1] = newPos.y;
}
m_x[0] = newPos.x;
m_y[0] = newPos.y;
}

View File

@ -57,6 +57,7 @@ namespace ui {
bool jmouse_poll();
void _internal_no_mouse_position();
void _internal_set_mouse_position(const gfx::Point& newPos);
void _internal_set_mouse_buttons(MouseButtons buttons);