diff --git a/Source/GSTheme.m b/Source/GSTheme.m index 884454510..59e49fa15 100644 --- a/Source/GSTheme.m +++ b/Source/GSTheme.m @@ -597,8 +597,7 @@ typedef struct { int pos; int end; - NSAssert(elementState <= GSThemeSelectedState, NSInvalidArgumentException); - if (elementState < 0) + if (elementState < 0 || elementState > GSThemeSelectedState) { pos = 0; end = GSThemeSelectedState; @@ -1177,8 +1176,7 @@ typedef struct { int pos; int end; - NSAssert(elementState <= GSThemeSelectedState, NSInvalidArgumentException); - if (elementState < 0) + if (elementState < 0 || elementState > GSThemeSelectedState) { pos = 0; end = GSThemeSelectedState; diff --git a/Source/GSThemeTools.m b/Source/GSThemeTools.m index 065e1d6b0..af5d0e007 100644 --- a/Source/GSThemeTools.m +++ b/Source/GSThemeTools.m @@ -732,26 +732,9 @@ withRepeatedImage: (NSImage*)image GSDrawTiles *c = (GSDrawTiles*)NSCopyObject(self, 0, zone); unsigned i; - c->images[0] = [images[0] copy]; - for (i = 1; i < 9; i++) + for (i = 0; i < 9; i++) { - unsigned j; - - for (j = 0; j < i; j++) - { - if (images[i] == images[j]) - { - break; - } - } - if (j < i) - { - c->images[i] = RETAIN(c->images[j]); - } - else - { - c->images[i] = [images[i] copy]; - } + c->images[i] = [images[i] copyWithZone: zone]; } c->style = style; return c; @@ -883,15 +866,10 @@ withRepeatedImage: (NSImage*)image } else { -#if !defined(__MINGW32__) -/* This code raises an exception on windows (tested 30/10/2009) ... why? */ images[i] = [[self extractImageFrom: image withRect: rects[i]] retain]; rects[i].origin.x = 0; rects[i].origin.y = 0; -#else - images[i] = [image retain]; -#endif } } } diff --git a/Source/NSApplication.m b/Source/NSApplication.m index ed7c8dbcb..7cff962dd 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -1821,6 +1821,7 @@ See Also: -runModalForWindow: } else { +NSLog(@"Discard %@", event); event = nil; // Ignore/discard this event. } } @@ -1845,8 +1846,9 @@ See Also: -runModalForWindow: /* * Check to see if the window has gone away - if so, end session. */ - if ([[self windows] indexOfObjectIdenticalTo: _session->window] == NSNotFound - || ![_session->window isVisible]) + if ([[self windows] indexOfObjectIdenticalTo: _session->window] + == NSNotFound + || ![_session->window isVisible]) { [self stopModal]; } @@ -2045,11 +2047,11 @@ See -runModalForWindow: if (!theEvent) NSDebugLLog(@"NSEvent", @"NSEvent is nil!\n"); if (type == NSMouseMoved) - NSDebugLLog(@"NSMotionEvent", @"Send move (%d) to window %d", - type, [window windowNumber]); + NSDebugLLog(@"NSMotionEvent", @"Send move (%d) to %@", + type, window); else - NSDebugLLog(@"NSEvent", @"Send NSEvent type: %d to window %d", - type, [window windowNumber]); + NSDebugLLog(@"NSEvent", @"Send NSEvent type: %d to %@", + type, window); if (window) [window sendEvent: theEvent]; else if (type == NSRightMouseDown) @@ -3877,7 +3879,7 @@ struct _DelegateWrapper { _key_window = obj; } - else + else if (_key_window != obj) { NSLog(@"Bogus attempt to set key window"); } @@ -3891,7 +3893,7 @@ struct _DelegateWrapper { _main_window = obj; } - else + else if (_main_window != obj) { NSLog(@"Bogus attempt to set main window"); } diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 9a8041409..56ac074ff 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -800,6 +800,12 @@ many times. [super dealloc]; } +- (NSString*) description +{ + return [[super description] stringByAppendingFormat: @"Number: %d Title: %@", + [self windowNumber], [self title]]; +} + - (void) _startBackendWindow { NSDictionary *info; @@ -3539,7 +3545,10 @@ resetCursorRectsForView(NSView *theView) We let NSAppKitDefined events through since they deal with window ordering. */ if (!_f.visible && [theEvent type] != NSAppKitDefined) - return; + { + NSDebugLLog(@"NSEvent", @"Discard (window not visible) %@", theEvent); + return; + } if (!_f.cursor_rects_valid) { @@ -3548,8 +3557,9 @@ resetCursorRectsForView(NSView *theView) type = [theEvent type]; if ([self ignoresMouseEvents] - && GSMouseEventMask == NSEventMaskFromType(type)) + && GSMouseEventMask == NSEventMaskFromType(type)) { + NSDebugLLog(@"NSEvent", @"Discard (window ignoring mouse) %@", theEvent); return; } @@ -3626,6 +3636,10 @@ resetCursorRectsForView(NSView *theView) [self mouseDown: theEvent]; } } + else + { + NSDebugLLog(@"NSEvent", @"Discard (window closed) %@", theEvent); + } _lastPoint = [theEvent locationInWindow]; break; }