mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Refactor HAS_MOUSE flag handling
Now each widget is responsible to enable/disable its own HAS_MOUSE flag in response to the kMouseEnter/Leave message received. Also there is no need to iterate over the parents since these messages are propagated to the parent
This commit is contained in:
parent
f67643a24e
commit
9e396227c2
@ -1012,13 +1012,6 @@ void Manager::setMouse(Widget* widget)
|
||||
msg->setPropagateToParent(true);
|
||||
msg->setCommonAncestor(commonAncestor);
|
||||
enqueueMessage(msg);
|
||||
|
||||
// Remove HAS_MOUSE from all the hierarchy
|
||||
auto a = mouse_widget;
|
||||
while (a && a != commonAncestor) {
|
||||
a->disableFlags(HAS_MOUSE);
|
||||
a = a->parent();
|
||||
}
|
||||
}
|
||||
|
||||
// If the mouse is captured, we can just put the HAS_MOUSE flag in
|
||||
@ -1049,13 +1042,6 @@ void Manager::setMouse(Widget* widget)
|
||||
mousePos,
|
||||
kKeyUninitializedModifier,
|
||||
PointerType::Unknown);
|
||||
|
||||
// Add HAS_MOUSE to all the hierarchy
|
||||
auto a = mouse_widget;
|
||||
while (a && a != commonAncestor) {
|
||||
a->enableFlags(HAS_MOUSE);
|
||||
a = a->parent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ bool TooltipManager::onProcessMessage(Message* msg)
|
||||
m_timer->start();
|
||||
}
|
||||
}
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
case kKeyDownMessage:
|
||||
|
@ -1620,6 +1620,14 @@ bool Widget::onProcessMessage(Message* msg)
|
||||
else
|
||||
break;
|
||||
|
||||
case kMouseEnterMessage:
|
||||
enableFlags(HAS_MOUSE);
|
||||
return true;
|
||||
|
||||
case kMouseLeaveMessage:
|
||||
disableFlags(HAS_MOUSE);
|
||||
return true;
|
||||
|
||||
case kSetCursorMessage:
|
||||
// Propagate the message to the parent.
|
||||
if (parent())
|
||||
|
Loading…
x
Reference in New Issue
Block a user