Module: wine Branch: master Commit: 4e0e9ca84a89d1ac2b548ee4a6224b764af2d23d URL: http://source.winehq.org/git/wine.git/?a=commit;h=4e0e9ca84a89d1ac2b548ee4a6...
Author: Ken Thomases ken@codeweavers.com Date: Wed Sep 25 15:10:57 2013 -0500
winemac: When programmatically focusing a window, don't generate WINDOW_LOST_FOCUS event for previously focused window.
That event can confuse things if the program switches focus from A to B and then back to A and then processes events. It will get an event saying that A lost focus in Cocoa, check that A does indeed have current focus in Wine, and so switch focus away from it (to the desktop window). (It then gets an event that B lost focus, but that does nothing at that point.)
---
dlls/winemac.drv/cocoa_window.h | 1 - dlls/winemac.drv/cocoa_window.m | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h index 8672812..8893f85 100644 --- a/dlls/winemac.drv/cocoa_window.h +++ b/dlls/winemac.drv/cocoa_window.h @@ -58,7 +58,6 @@ NSSize savedContentMinSize; NSSize savedContentMaxSize;
- BOOL causing_becomeKeyWindow; BOOL ignore_windowMiniaturize; BOOL ignore_windowDeminiaturize; } diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index a602adb..43be5d5 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -464,6 +464,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
@implementation WineWindow
+ static WineWindow* causing_becomeKeyWindow; + @synthesize disabled, noActivate, floating, fullscreen, latentParentWindow, hwnd, queue; @synthesize surface, surface_mutex; @synthesize shape, shapeChangedSinceLastDraw; @@ -1200,9 +1202,9 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) { [self orderBelow:nil orAbove:nil activate:activate];
- causing_becomeKeyWindow = TRUE; + causing_becomeKeyWindow = self; [self makeKeyWindow]; - causing_becomeKeyWindow = FALSE; + causing_becomeKeyWindow = nil; }
- (void) postKey:(uint16_t)keyCode @@ -1263,7 +1265,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) */ - (BOOL) canBecomeKeyWindow { - if (causing_becomeKeyWindow) return YES; + if (causing_becomeKeyWindow == self) return YES; if (self.disabled || self.noActivate) return NO; return [self isKeyWindow]; } @@ -1432,7 +1434,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) if (event) [self flagsChanged:event];
- if (causing_becomeKeyWindow) return; + if (causing_becomeKeyWindow == self) return;
[controller windowGotFocus:self]; } @@ -1465,9 +1467,9 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
if (!self.disabled && !self.noActivate) { - causing_becomeKeyWindow = TRUE; + causing_becomeKeyWindow = self; [self makeKeyWindow]; - causing_becomeKeyWindow = FALSE; + causing_becomeKeyWindow = nil; [controller windowGotFocus:self]; }