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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 1 09:32:58 CST 2015


Module: wine
Branch: master
Commit: 5c992f965335ccb02a90ebcb10a881649cbab859
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5c992f965335ccb02a90ebcb10a881649cbab859

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Nov 30 20:10:32 2015 -0600

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/cocoa_app.m | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 3a80f1d..fb9edc2 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1745,7 +1745,23 @@ static NSString* WineLocalizedString(unsigned int stringID)
 
         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];
         }




More information about the wine-cvs mailing list