mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-28 05:37:19 +00:00
Fix keyboard shortcuts dialog items: don't create/dsetroy children widgets continuously inside KeyItem
Don't send a leave message (e.g. kMouseLeaveMessage) if the old focused widget (mouse_widget) if an ancestor of the new focused widget.
This commit is contained in:
parent
c0fcef0240
commit
7e638cddcc
@ -743,7 +743,7 @@ void Manager::setFocus(Widget* widget)
|
|||||||
Widget* commonAncestor = findLowestCommonAncestor(focus_widget, widget);
|
Widget* commonAncestor = findLowestCommonAncestor(focus_widget, widget);
|
||||||
|
|
||||||
// Fetch the focus
|
// Fetch the focus
|
||||||
if (focus_widget) {
|
if (focus_widget && focus_widget != commonAncestor) {
|
||||||
auto msg = new Message(kFocusLeaveMessage);
|
auto msg = new Message(kFocusLeaveMessage);
|
||||||
msg->setRecipient(focus_widget);
|
msg->setRecipient(focus_widget);
|
||||||
msg->setPropagateToParent(true);
|
msg->setPropagateToParent(true);
|
||||||
@ -797,10 +797,9 @@ void Manager::setMouse(Widget* widget)
|
|||||||
Widget* commonAncestor = findLowestCommonAncestor(mouse_widget, widget);
|
Widget* commonAncestor = findLowestCommonAncestor(mouse_widget, widget);
|
||||||
|
|
||||||
// Fetch the mouse
|
// Fetch the mouse
|
||||||
if (mouse_widget) {
|
if (mouse_widget && mouse_widget != commonAncestor) {
|
||||||
auto msg = new Message(kMouseLeaveMessage);
|
auto msg = new Message(kMouseLeaveMessage);
|
||||||
msg->setRecipient(mouse_widget);
|
msg->setRecipient(mouse_widget);
|
||||||
msg->setCommonAncestor(commonAncestor);
|
|
||||||
msg->setPropagateToParent(true);
|
msg->setPropagateToParent(true);
|
||||||
msg->setCommonAncestor(commonAncestor);
|
msg->setCommonAncestor(commonAncestor);
|
||||||
enqueueMessage(msg);
|
enqueueMessage(msg);
|
||||||
@ -1584,9 +1583,6 @@ Widget* Manager::findLowestCommonAncestor(Widget* a, Widget* b)
|
|||||||
if (!a || !b)
|
if (!a || !b)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
a = a->parent();
|
|
||||||
b = b->parent();
|
|
||||||
|
|
||||||
Widget* u = a;
|
Widget* u = a;
|
||||||
Widget* v = b;
|
Widget* v = b;
|
||||||
int aDepth = 0;
|
int aDepth = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user