Ken Thomases : winemac: When ordering sibling child windows, don' t remove and re-add ones already in the right order.
Alexandre Julliard
julliard at winehq.org
Tue Sep 3 13:38:03 CDT 2013
Module: wine
Branch: master
Commit: 675b052572ee195b784581bf8d7bb399b9081c59
URL: http://source.winehq.org/git/wine.git/?a=commit;h=675b052572ee195b784581bf8d7bb399b9081c59
Author: Ken Thomases <ken at codeweavers.com>
Date: Mon Sep 2 22:49:05 2013 -0500
winemac: When ordering sibling child windows, don't remove and re-add ones already in the right order.
---
dlls/winemac.drv/cocoa_window.m | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 7553cfc..2ad406f 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -875,7 +875,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
{
NSMutableArray* windowNumbers;
NSNumber* childWindowNumber;
- NSUInteger otherIndex;
+ NSUInteger otherIndex, limit;
+ NSArray* origChildren;
NSMutableArray* children;
// Get the z-order from the window server and modify it to reflect the
@@ -888,7 +889,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
// Get our child windows and sort them in the reverse of the desired
// z-order (back-to-front).
- children = [[[self childWindows] mutableCopy] autorelease];
+ origChildren = [self childWindows];
+ children = [[origChildren mutableCopy] autorelease];
[children sortWithOptions:NSSortStable
usingComparator:^NSComparisonResult(id obj1, id obj2){
NSNumber* window1Number = [NSNumber numberWithInteger:[obj1 windowNumber]];
@@ -912,6 +914,16 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
return NSOrderedSame;
}];
+ // If the current and desired children arrays match up to a point, leave
+ // those matching children alone.
+ limit = MIN([origChildren count], [children count]);
+ for (otherIndex = 0; otherIndex < limit; otherIndex++)
+ {
+ if ([origChildren objectAtIndex:otherIndex] != [children objectAtIndex:otherIndex])
+ break;
+ }
+ [children removeObjectsInRange:NSMakeRange(0, otherIndex)];
+
// Remove all of the child windows and re-add them back-to-front so they
// are in the desired order.
for (other in children)
More information about the wine-cvs
mailing list