winemac: In -setFrameIfOnScreen:, avoid some work if the frame didn't change.

This commit is contained in:
Ken Thomases 2013-05-16 18:43:37 -05:00 committed by Alexandre Julliard
parent 27510fae8e
commit 94746f1d2d
1 changed files with 17 additions and 18 deletions

View File

@ -727,7 +727,6 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
{
NSArray* screens = [NSScreen screens];
BOOL on_screen = [self isOrderedIn];
NSRect frame, oldFrame;
if (![screens count]) return on_screen;
@ -742,8 +741,16 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
[self doOrderOut];
}
/* The back end is establishing a new window size and position. It's
not interested in any stale events regarding those that may be sitting
in the queue. */
[queue discardEventsMatchingMask:event_mask_for_type(WINDOW_FRAME_CHANGED)
forWindow:self];
if (!NSIsEmptyRect(contentRect))
{
NSRect frame, oldFrame;
oldFrame = [self frame];
frame = [self frameRectForContentRect:contentRect];
if (!NSEqualRects(frame, oldFrame))
@ -752,8 +759,6 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
[self setFrameOrigin:frame.origin];
else
[self setFrame:frame display:YES];
}
}
if (on_screen)
{
@ -763,13 +768,7 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
event. The back end will ignore it if nothing actually changed. */
[self windowDidResize:nil];
}
else
{
/* The back end is establishing a new window size and position. It's
not interested in any stale events regarding those that may be sitting
in the queue. */
[queue discardEventsMatchingMask:event_mask_for_type(WINDOW_FRAME_CHANGED)
forWindow:self];
}
}
return on_screen;