Ken Thomases : winemac: In -setFrameIfOnScreen:, avoid some work if the frame didn't change.
Alexandre Julliard
julliard at winehq.org
Fri May 17 14:24:33 CDT 2013
Module: wine
Branch: master
Commit: 94746f1d2dfc2067b95548cce329e913b70181e5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=94746f1d2dfc2067b95548cce329e913b70181e5
Author: Ken Thomases <ken at codeweavers.com>
Date: Thu May 16 18:43:37 2013 -0500
winemac: In -setFrameIfOnScreen:, avoid some work if the frame didn't change.
---
dlls/winemac.drv/cocoa_window.m | 33 ++++++++++++++++-----------------
1 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 57d6e5d..ae5f40b 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -727,7 +727,6 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
{
NSArray* screens = [NSScreen screens];
BOOL on_screen = [self isOrderedIn];
- NSRect frame, oldFrame;
if (![screens count]) return on_screen;
@@ -742,8 +741,16 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
[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,24 +759,16 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
[self setFrameOrigin:frame.origin];
else
[self setFrame:frame display:YES];
- }
- }
- if (on_screen)
- {
- [[WineApplicationController sharedController] adjustWindowLevels];
+ 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];
+ /* 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];
+ }
+ }
}
return on_screen;
More information about the wine-cvs
mailing list