winemac: In -setFrameIfOnScreen:, avoid some work if the frame didn't change.
This commit is contained in:
parent
27510fae8e
commit
94746f1d2d
|
@ -727,7 +727,6 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
|
||||||
{
|
{
|
||||||
NSArray* screens = [NSScreen screens];
|
NSArray* screens = [NSScreen screens];
|
||||||
BOOL on_screen = [self isOrderedIn];
|
BOOL on_screen = [self isOrderedIn];
|
||||||
NSRect frame, oldFrame;
|
|
||||||
|
|
||||||
if (![screens count]) return on_screen;
|
if (![screens count]) return on_screen;
|
||||||
|
|
||||||
|
@ -742,8 +741,16 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
|
||||||
[self doOrderOut];
|
[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))
|
if (!NSIsEmptyRect(contentRect))
|
||||||
{
|
{
|
||||||
|
NSRect frame, oldFrame;
|
||||||
|
|
||||||
oldFrame = [self frame];
|
oldFrame = [self frame];
|
||||||
frame = [self frameRectForContentRect:contentRect];
|
frame = [self frameRectForContentRect:contentRect];
|
||||||
if (!NSEqualRects(frame, oldFrame))
|
if (!NSEqualRects(frame, oldFrame))
|
||||||
|
@ -752,8 +759,6 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
|
||||||
[self setFrameOrigin:frame.origin];
|
[self setFrameOrigin:frame.origin];
|
||||||
else
|
else
|
||||||
[self setFrame:frame display:YES];
|
[self setFrame:frame display:YES];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (on_screen)
|
if (on_screen)
|
||||||
{
|
{
|
||||||
|
@ -763,13 +768,7 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
|
||||||
event. The back end will ignore it if nothing actually changed. */
|
event. The back end will ignore it if nothing actually changed. */
|
||||||
[self windowDidResize:nil];
|
[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;
|
return on_screen;
|
||||||
|
|
Loading…
Reference in New Issue