Redir first kMouseMoveMessage with correct mouse position from combobox -> listbox

This commit is contained in:
David Capello 2021-04-20 19:42:41 -03:00
parent 5aa765a942
commit 597a2cc831

View File

@ -516,19 +516,23 @@ bool ComboBoxEntry::onProcessMessage(Message* msg)
case kMouseMoveMessage:
if (hasCapture()) {
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
Widget* pick = manager()->pickFromScreenPos(
mouseMsg->display()->nativeWindow()->pointToScreen(mouseMsg->position()));
gfx::Point screenPos = mouseMsg->display()->nativeWindow()->pointToScreen(mouseMsg->position());
Widget* pick = manager()->pickFromScreenPos(screenPos);
Widget* listbox = m_comboBox->m_listbox;
if (pick != nullptr &&
(pick == listbox || pick->hasAncestor(listbox))) {
releaseMouse();
MouseMessage mouseMsg2(kMouseDownMessage,
mouseMsg->pointerType(),
mouseMsg->button(),
mouseMsg->modifiers(),
mouseMsg->position());
MouseMessage mouseMsg2(
kMouseDownMessage,
mouseMsg->pointerType(),
mouseMsg->button(),
mouseMsg->modifiers(),
(mouseMsg->display() == pick->display() ?
mouseMsg->position():
pick->display()->nativeWindow()->pointFromScreen(screenPos)));
mouseMsg2.setDisplay(pick->display());
pick->sendMessage(&mouseMsg2);
return true;
}