Commit b8da8fa4 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Ignore Cocoa child windows which aren't instances of WineWindow.

On Yosemite, in full-screen mode, Cocoa adds child windows of its own to our windows. These windows are, of course, not instances of WineWindow. So, when we call WineWindow-specific methods on them, it throws exceptions.
parent b2ef8775
...@@ -195,6 +195,8 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -195,6 +195,8 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
@property (retain, nonatomic) NSTimer* liveResizeDisplayTimer; @property (retain, nonatomic) NSTimer* liveResizeDisplayTimer;
@property (readonly, copy, nonatomic) NSArray* childWineWindows;
- (void) updateColorSpace; - (void) updateColorSpace;
- (BOOL) becameEligibleParentOrChild; - (BOOL) becameEligibleParentOrChild;
...@@ -834,7 +836,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -834,7 +836,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
// Became non-floating. If parent of floating children, make that // Became non-floating. If parent of floating children, make that
// relationship latent. // relationship latent.
WineWindow* child; WineWindow* child;
for (child in [[[self childWindows] copy] autorelease]) for (child in [self childWineWindows])
{ {
if (child.floating) if (child.floating)
[child becameIneligibleChild]; [child becameIneligibleChild];
...@@ -1012,7 +1014,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -1012,7 +1014,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
- (void) becameIneligibleParentOrChild - (void) becameIneligibleParentOrChild
{ {
NSArray* childWindows = [self childWindows]; NSArray* childWindows = [self childWineWindows];
[self becameIneligibleChild]; [self becameIneligibleChild];
...@@ -1020,7 +1022,6 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -1020,7 +1022,6 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
{ {
WineWindow* child; WineWindow* child;
childWindows = [[childWindows copy] autorelease];
for (child in childWindows) for (child in childWindows)
{ {
child.latentParentWindow = self; child.latentParentWindow = self;
...@@ -1101,7 +1102,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -1101,7 +1102,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
// Get our child windows and sort them in the reverse of the desired // Get our child windows and sort them in the reverse of the desired
// z-order (back-to-front). // z-order (back-to-front).
origChildren = [self childWindows]; origChildren = [self childWineWindows];
children = [[origChildren mutableCopy] autorelease]; children = [[origChildren mutableCopy] autorelease];
[children sortWithOptions:NSSortStable [children sortWithOptions:NSSortStable
usingComparator:^NSComparisonResult(id obj1, id obj2){ usingComparator:^NSComparisonResult(id obj1, id obj2){
...@@ -1315,7 +1316,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -1315,7 +1316,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
[self setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; [self setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
} }
if (equalSizes && [[self childWindows] count]) if (equalSizes && [[self childWineWindows] count])
{ {
// If we change the window frame such that the origin moves // If we change the window frame such that the origin moves
// but the size doesn't change, then Cocoa moves child // but the size doesn't change, then Cocoa moves child
...@@ -1611,6 +1612,15 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif ...@@ -1611,6 +1612,15 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
[super toggleFullScreen:sender]; [super toggleFullScreen:sender];
} }
- (NSArray*) childWineWindows
{
NSArray* childWindows = self.childWindows;
NSIndexSet* indexes = [childWindows indexesOfObjectsPassingTest:^BOOL(id child, NSUInteger idx, BOOL *stop){
return [child isKindOfClass:[WineWindow class]];
}];
return [childWindows objectsAtIndexes:indexes];
}
// We normally use the generic/calibrated RGB color space for the window, // We normally use the generic/calibrated RGB color space for the window,
// rather than the device color space, to avoid expensive color conversion // rather than the device color space, to avoid expensive color conversion
// which slows down drawing. However, for windows displaying OpenGL, having // which slows down drawing. However, for windows displaying OpenGL, having
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment