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];
|
||||
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,26 +759,18 @@ - (BOOL) setFrameIfOnScreen:(NSRect)contentRect
|
|||
[self setFrameOrigin:frame.origin];
|
||||
else
|
||||
[self setFrame:frame display:YES];
|
||||
|
||||
if (on_screen)
|
||||
{
|
||||
[[WineApplicationController sharedController] adjustWindowLevels];
|
||||
|
||||
/* In case Cocoa adjusted the frame we tried to set, generate a frame-changed
|
||||
event. The back end will ignore it if nothing actually changed. */
|
||||
[self windowDidResize:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (on_screen)
|
||||
{
|
||||
[[WineApplicationController sharedController] adjustWindowLevels];
|
||||
|
||||
/* In case Cocoa adjusted the frame we tried to set, generate a frame-changed
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue