mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 13:21:34 +00:00
Avoid using CallbackMessage for MouseEnter/Leave
Instead of wrapping the MouseEnter and MouseLeave OS events handling inside a UI CallbackMessage, we now enqueue the corresponding kMouseEnterMessage and kMouseLeaveMessage
This commit is contained in:
parent
6093282ac3
commit
f67643a24e
@ -488,34 +488,29 @@ void Manager::generateMessagesFromOSEvents()
|
||||
}
|
||||
|
||||
case os::Event::MouseEnter: {
|
||||
auto msg = new CallbackMessage([osEvent, display]{
|
||||
if (get_multiple_displays()) {
|
||||
if (osEvent.window()) {
|
||||
ASSERT(display != nullptr);
|
||||
_internal_set_mouse_display(display);
|
||||
}
|
||||
if (get_multiple_displays()) {
|
||||
if (osEvent.window()) {
|
||||
ASSERT(display != nullptr);
|
||||
_internal_set_mouse_display(display);
|
||||
}
|
||||
set_mouse_cursor(kArrowCursor);
|
||||
mouse_display = display;
|
||||
});
|
||||
msg->setRecipient(this);
|
||||
enqueueMessage(msg);
|
||||
}
|
||||
set_mouse_cursor(kArrowCursor);
|
||||
mouse_display = display;
|
||||
|
||||
auto* widget = pick(osEvent.position());
|
||||
setMouse(widget);
|
||||
lastMouseMoveEvent = osEvent;
|
||||
break;
|
||||
}
|
||||
|
||||
case os::Event::MouseLeave: {
|
||||
auto msg = new CallbackMessage([this, display]{
|
||||
if (mouse_display == display) {
|
||||
set_mouse_cursor(kOutsideDisplay);
|
||||
setMouse(nullptr);
|
||||
if (mouse_display == display) {
|
||||
set_mouse_cursor(kOutsideDisplay);
|
||||
setMouse(nullptr);
|
||||
|
||||
_internal_no_mouse_position();
|
||||
mouse_display = nullptr;
|
||||
}
|
||||
});
|
||||
msg->setRecipient(this);
|
||||
enqueueMessage(msg);
|
||||
_internal_no_mouse_position();
|
||||
mouse_display = nullptr;
|
||||
}
|
||||
|
||||
// To avoid calling kSetCursorMessage when the mouse leaves
|
||||
// the window.
|
||||
|
Loading…
x
Reference in New Issue
Block a user