winemac: Request mouse move events when our window is active even when cursor is outside it.

This commit is contained in:
Ken Thomases 2013-02-24 22:53:37 -06:00 committed by Alexandre Julliard
parent 0a56ef356a
commit 5d8e685297
2 changed files with 19 additions and 1 deletions

View File

@ -565,6 +565,21 @@ - (void) sendEvent:(NSEvent*)anEvent
{
WineWindow* targetWindow;
/* 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]])

View File

@ -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 |