Ken Thomases : winemac: Fix the logic for checking if a view is already in the intended z-order.

Alexandre Julliard julliard at winehq.org
Fri Jun 3 10:03:45 CDT 2016


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Fri Jun  3 00:06:49 2016 -0500

winemac: Fix the logic for checking if a view is already in the intended z-order.

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

---

 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;
         }
 




More information about the wine-cvs mailing list