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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2016-06-03 00:06:49 -05:00 committed by Alexandre Julliard
parent bdbb3514bb
commit 102cd6dcae
1 changed files with 3 additions and 3 deletions

View File

@ -3343,11 +3343,11 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma
{ {
NSArray* subviews = [superview subviews]; NSArray* subviews = [superview subviews];
NSUInteger index = [subviews indexOfObjectIdenticalTo:view]; NSUInteger index = [subviews indexOfObjectIdenticalTo:view];
if (!prev && !next && index == 0) if (!prev && !next && index == [subviews count] - 1)
return; return;
if (prev && index > 0 && [subviews objectAtIndex:index - 1] == prev) if (prev && index + 1 < [subviews count] && [subviews objectAtIndex:index + 1] == prev)
return; return;
if (!prev && next && index + 1 < [subviews count] && [subviews objectAtIndex:index + 1] == next) if (!prev && next && index > 0 && [subviews objectAtIndex:index - 1] == next)
return; return;
} }