winemac: Request mouse move events when our window is active even when cursor is outside it.
This commit is contained in:
parent
0a56ef356a
commit
5d8e685297
|
@ -565,7 +565,22 @@ - (void) sendEvent:(NSEvent*)anEvent
|
||||||
{
|
{
|
||||||
WineWindow* targetWindow;
|
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]])
|
if ([targetWindow isKindOfClass:[WineWindow class]])
|
||||||
{
|
{
|
||||||
|
|
|
@ -273,6 +273,7 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w
|
||||||
[window disableCursorRects];
|
[window disableCursorRects];
|
||||||
[window setShowsResizeIndicator:NO];
|
[window setShowsResizeIndicator:NO];
|
||||||
[window setHasShadow:wf->shadow];
|
[window setHasShadow:wf->shadow];
|
||||||
|
[window setAcceptsMouseMovedEvents:YES];
|
||||||
[window setColorSpace:[NSColorSpace genericRGBColorSpace]];
|
[window setColorSpace:[NSColorSpace genericRGBColorSpace]];
|
||||||
[window setDelegate:window];
|
[window setDelegate:window];
|
||||||
window.hwnd = hwnd;
|
window.hwnd = hwnd;
|
||||||
|
@ -283,6 +284,8 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w
|
||||||
return nil;
|
return nil;
|
||||||
[contentView setAutoresizesSubviews:NO];
|
[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]
|
trackingArea = [[[NSTrackingArea alloc] initWithRect:[contentView bounds]
|
||||||
options:(NSTrackingMouseMoved |
|
options:(NSTrackingMouseMoved |
|
||||||
NSTrackingActiveAlways |
|
NSTrackingActiveAlways |
|
||||||
|
|
Loading…
Reference in New Issue