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

Ken Thomases ken at codeweavers.com
Mon Nov 30 20:10:32 CST 2015


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>
---
 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 @@ - (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];
         }
-- 
2.6.0




More information about the wine-patches mailing list