diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 7e22221e8df..47ec05c15bf 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -565,7 +565,22 @@ - (void) sendEvent:(NSEvent*)anEvent { WineWindow* targetWindow; - targetWindow = (WineWindow*)[anEvent window]; + /* Because of the way -[NSWindow setAcceptsMouseMovedEvents:] works, the + event indicates its window is the main window, even if the cursor is + over a different window. Find the actual WineWindow that is under the + cursor and post the event as being for that window. */ + if (type == NSMouseMoved) + { + CGPoint cgpoint = CGEventGetLocation([anEvent CGEvent]); + NSPoint point = [self flippedMouseLocation:NSPointFromCGPoint(cgpoint)]; + NSInteger windowUnderNumber; + + windowUnderNumber = [NSWindow windowNumberAtPoint:point + belowWindowWithWindowNumber:0]; + targetWindow = (WineWindow*)[self windowWithWindowNumber:windowUnderNumber]; + } + else + targetWindow = (WineWindow*)[anEvent window]; if ([targetWindow isKindOfClass:[WineWindow class]]) { diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index b8bc79d8ffe..204a0bcd9fe 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -273,6 +273,7 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w [window disableCursorRects]; [window setShowsResizeIndicator:NO]; [window setHasShadow:wf->shadow]; + [window setAcceptsMouseMovedEvents:YES]; [window setColorSpace:[NSColorSpace genericRGBColorSpace]]; [window setDelegate:window]; window.hwnd = hwnd; @@ -283,6 +284,8 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w return nil; [contentView setAutoresizesSubviews:NO]; + /* We use tracking areas in addition to setAcceptsMouseMovedEvents:YES + because they give us mouse moves in the background. */ trackingArea = [[[NSTrackingArea alloc] initWithRect:[contentView bounds] options:(NSTrackingMouseMoved | NSTrackingActiveAlways |