Fix Editor scroll issues: we cannot process several WM_MOUSEMOVE in one UI loop-cycle

We have to wait to validate not-scrolled regions before we can use
Widget::scrollRegion() or Window::moveWindow() again. This is an issue
to see in the future (to avoid lossing mouse move messages). At the moment,
one solution is to use the last received mouse move message.
This commit is contained in:
David Capello 2014-05-04 21:40:46 -03:00
parent 94b2fb6dde
commit 778578b210

View File

@ -447,6 +447,8 @@ static MouseButtons mouse_buttons_from_she_to_ui(const she::Event& sheEvent)
void Manager::generateMessagesFromSheEvents()
{
she::Event lastMouseMoveEvent;
// Events from "she" layer.
she::Event sheEvent;
for (;;) {
@ -477,6 +479,8 @@ void Manager::generateMessagesFromSheEvents()
jmouse_set_cursor(kNoCursor);
setMouse(NULL);
_internal_set_mouse_position(gfx::Point(-1, -1));
break;
}
@ -484,9 +488,12 @@ void Manager::generateMessagesFromSheEvents()
if (!mouse_events_from_she)
continue;
_internal_set_mouse_position(sheEvent.position());
handleMouseMove(sheEvent.position(), m_mouseButtons);
// TODO Currently we cannot handleMouseMove() for each
// she::Event::MouseMove as the UI library is not prepared yet
// to process more than one kMouseMoveMessage message for
// loop-cycle. The main problem are the functions to control
// scroll (Window::moveWindow() and Widget::scrollRegion()).
lastMouseMoveEvent = sheEvent;
break;
}
@ -532,6 +539,12 @@ void Manager::generateMessagesFromSheEvents()
}
}
}
if (lastMouseMoveEvent.type() != she::Event::None) {
_internal_set_mouse_position(sheEvent.position());
handleMouseMove(sheEvent.position(), m_mouseButtons);
}
}
void Manager::handleMouseMove(const gfx::Point& mousePos, MouseButtons mouseButtons)