[PATCH 2/3] winemac: Fix the logic for checking if a view is already in the intended z-order.

Ken Thomases ken at codeweavers.com
Fri Jun 3 00:06:49 CDT 2016


-[NSView subviews] returns the views in back-to-front order, not front-to-back
as I had thought.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
 dlls/winemac.drv/cocoa_window.m | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 1b0f9cc..0b975f2 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -3343,11 +3343,11 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma
         {
             NSArray* subviews = [superview subviews];
             NSUInteger index = [subviews indexOfObjectIdenticalTo:view];
-            if (!prev && !next && index == 0)
+            if (!prev && !next && index == [subviews count] - 1)
                 return;
-            if (prev && index > 0 && [subviews objectAtIndex:index - 1] == prev)
+            if (prev && index + 1 < [subviews count] && [subviews objectAtIndex:index + 1] == prev)
                 return;
-            if (!prev && next && index + 1 < [subviews count] && [subviews objectAtIndex:index + 1] == next)
+            if (!prev && next && index > 0 && [subviews objectAtIndex:index - 1] == next)
                 return;
         }
 
-- 
2.8.2




More information about the wine-patches mailing list