Commit 4e0e9ca8 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: When programmatically focusing a window, don't generate…

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.)
parent e2bce62a
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
NSSize savedContentMinSize; NSSize savedContentMinSize;
NSSize savedContentMaxSize; NSSize savedContentMaxSize;
BOOL causing_becomeKeyWindow;
BOOL ignore_windowMiniaturize; BOOL ignore_windowMiniaturize;
BOOL ignore_windowDeminiaturize; BOOL ignore_windowDeminiaturize;
} }
......
...@@ -464,6 +464,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) ...@@ -464,6 +464,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
@implementation WineWindow @implementation WineWindow
static WineWindow* causing_becomeKeyWindow;
@synthesize disabled, noActivate, floating, fullscreen, latentParentWindow, hwnd, queue; @synthesize disabled, noActivate, floating, fullscreen, latentParentWindow, hwnd, queue;
@synthesize surface, surface_mutex; @synthesize surface, surface_mutex;
@synthesize shape, shapeChangedSinceLastDraw; @synthesize shape, shapeChangedSinceLastDraw;
...@@ -1200,9 +1202,9 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) ...@@ -1200,9 +1202,9 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
{ {
[self orderBelow:nil orAbove:nil activate:activate]; [self orderBelow:nil orAbove:nil activate:activate];
causing_becomeKeyWindow = TRUE; causing_becomeKeyWindow = self;
[self makeKeyWindow]; [self makeKeyWindow];
causing_becomeKeyWindow = FALSE; causing_becomeKeyWindow = nil;
} }
- (void) postKey:(uint16_t)keyCode - (void) postKey:(uint16_t)keyCode
...@@ -1263,7 +1265,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) ...@@ -1263,7 +1265,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
*/ */
- (BOOL) canBecomeKeyWindow - (BOOL) canBecomeKeyWindow
{ {
if (causing_becomeKeyWindow) return YES; if (causing_becomeKeyWindow == self) return YES;
if (self.disabled || self.noActivate) return NO; if (self.disabled || self.noActivate) return NO;
return [self isKeyWindow]; return [self isKeyWindow];
} }
...@@ -1432,7 +1434,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) ...@@ -1432,7 +1434,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
if (event) if (event)
[self flagsChanged:event]; [self flagsChanged:event];
if (causing_becomeKeyWindow) return; if (causing_becomeKeyWindow == self) return;
[controller windowGotFocus:self]; [controller windowGotFocus:self];
} }
...@@ -1465,9 +1467,9 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers) ...@@ -1465,9 +1467,9 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
if (!self.disabled && !self.noActivate) if (!self.disabled && !self.noActivate)
{ {
causing_becomeKeyWindow = TRUE; causing_becomeKeyWindow = self;
[self makeKeyWindow]; [self makeKeyWindow];
causing_becomeKeyWindow = FALSE; causing_becomeKeyWindow = nil;
[controller windowGotFocus:self]; [controller windowGotFocus:self];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment