Bug 1872997 - [cocoa] Don't trigger mouseenter/leave events for windows that ignore mouse events. r=mac-reviewers,mstange

In the patches above, we make some tooltips (which ignore mouse events)
actually overlap the mouse. That should be fine (and is fine on other
platforms) but Cocoa still sends mouseenter/leave events which confuse
the front-end.

This fixes that.

Differential Revision: https://phabricator.services.mozilla.com/D197905
This commit is contained in:
Emilio Cobos Álvarez 2024-01-10 22:51:28 +00:00
Родитель 267ec889a9
Коммит 3a54b24c9b
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -5001,12 +5001,15 @@ void ChildViewMouseTracker::OnDestroyWindow(NSWindow* aWindow) {
}
void ChildViewMouseTracker::MouseEnteredWindow(NSEvent* aEvent) {
sWindowUnderMouse = [aEvent window];
ReEvaluateMouseEnterState(aEvent);
NSWindow* window = aEvent.window;
if (!window.ignoresMouseEvents) {
sWindowUnderMouse = window;
ReEvaluateMouseEnterState(aEvent);
}
}
void ChildViewMouseTracker::MouseExitedWindow(NSEvent* aEvent) {
if (sWindowUnderMouse == [aEvent window]) {
if (sWindowUnderMouse == aEvent.window) {
sWindowUnderMouse = nil;
[sLastMouseMoveEvent release];
sLastMouseMoveEvent = nil;