winemac: Don't post a WINDOW_BROUGHT_FORWARD event for a click on a window which is already frontmost in its level.

Commit 793ab7d45 fixed a bug where WINDOW_BROUGHT_FORWARD events weren't being
posted when they should, but it caused a regression in Scribblenauts Unlimited.
Every click caused a window ordering operation that generated messages and
Scribblenauts would move the mouse cursor to the upper-left corner of the
window in response.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2015-11-30 20:10:32 -06:00 committed by Alexandre Julliard
parent ebcf8aadc5
commit 5c992f9653
1 changed files with 17 additions and 1 deletions

View File

@ -1745,7 +1745,23 @@ - (void) handleMouseButton:(NSEvent*)theEvent
if (windowBroughtForward)
{
[[windowBroughtForward ancestorWineWindow] postBroughtForwardEvent];
WineWindow* ancestor = [windowBroughtForward ancestorWineWindow];
NSInteger ancestorNumber = [ancestor windowNumber];
NSInteger ancestorLevel = [ancestor level];
for (NSNumber* windowNumberObject in [NSWindow windowNumbersWithOptions:0])
{
NSInteger windowNumber = [windowNumberObject integerValue];
if (windowNumber == ancestorNumber)
break;
WineWindow* otherWindow = (WineWindow*)[NSApp windowWithWindowNumber:windowNumber];
if ([otherWindow isKindOfClass:[WineWindow class]] && [otherWindow screen] &&
[otherWindow level] <= ancestorLevel && otherWindow == [otherWindow ancestorWineWindow])
{
[ancestor postBroughtForwardEvent];
break;
}
}
if (!process && ![windowBroughtForward isKeyWindow] && !windowBroughtForward.disabled && !windowBroughtForward.noActivate)
[self windowGotFocus:windowBroughtForward];
}