Module: wine Branch: master Commit: 8dae8ad8d8801fe6eceec0eff16239aed24b7f7d URL: https://source.winehq.org/git/wine.git/?a=commit;h=8dae8ad8d8801fe6eceec0eff...
Author: Tim Clem tclem@codeweavers.com Date: Wed Jan 19 11:13:45 2022 -0800
winemac.drv: Don't activate the app if its first window is WS_EX_NOACTIVATE.
This matches the behavior on Windows.
Signed-off-by: Tim Clem tclem@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winemac.drv/cocoa_app.h | 2 +- dlls/winemac.drv/cocoa_app.m | 9 ++++++--- dlls/winemac.drv/cocoa_window.h | 2 ++ dlls/winemac.drv/cocoa_window.m | 9 ++++++--- 4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.h b/dlls/winemac.drv/cocoa_app.h index 0b70a2fd55b..0689c22ec32 100644 --- a/dlls/winemac.drv/cocoa_app.h +++ b/dlls/winemac.drv/cocoa_app.h @@ -142,7 +142,7 @@ enum {
+ (WineApplicationController*) sharedController;
- - (void) transformProcessToForeground; + - (void) transformProcessToForeground:(BOOL)activateIfTransformed;
- (BOOL) registerEventQueue:(WineEventQueue*)queue; - (void) unregisterEventQueue:(WineEventQueue*)queue; diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 16a773e1470..8b6a1779b84 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -237,7 +237,7 @@ static NSString* WineLocalizedString(unsigned int stringID) [super dealloc]; }
- - (void) transformProcessToForeground + - (void) transformProcessToForeground:(BOOL)activateIfTransformed { if ([NSApp activationPolicy] != NSApplicationActivationPolicyRegular) { @@ -248,7 +248,10 @@ static NSString* WineLocalizedString(unsigned int stringID) NSMenuItem* item;
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - [NSApp activateIgnoringOtherApps:YES]; + + if (activateIfTransformed) + [NSApp activateIgnoringOtherApps:YES]; + #if defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 if (!enable_app_nap && [NSProcessInfo instancesRespondToSelector:@selector(beginActivityWithOptions:reason:)]) { @@ -884,7 +887,7 @@ static NSString* WineLocalizedString(unsigned int stringID) if (!modes.count) return FALSE;
- [self transformProcessToForeground]; + [self transformProcessToForeground:YES];
BOOL active = [NSApp isActive];
diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h index c7bcaedfd97..a83f2aa803b 100644 --- a/dlls/winemac.drv/cocoa_window.h +++ b/dlls/winemac.drv/cocoa_window.h @@ -28,6 +28,7 @@ { BOOL disabled; BOOL noForeground; + BOOL preventsAppActivation; BOOL floating; BOOL resizable; BOOL maximized; @@ -91,6 +92,7 @@ @property (retain, readonly, nonatomic) WineEventQueue* queue; @property (readonly, nonatomic) BOOL disabled; @property (readonly, nonatomic) BOOL noForeground; +@property (readonly, nonatomic) BOOL preventsAppActivation; @property (readonly, nonatomic) BOOL floating; @property (readonly, getter=isFullscreen, nonatomic) BOOL fullscreen; @property (readonly, getter=isFakingClose, nonatomic) BOOL fakingClose; diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 6301b47143e..bfa7e2fe8cc 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -391,6 +391,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
@property (readwrite, nonatomic) BOOL disabled; @property (readwrite, nonatomic) BOOL noForeground; +@property (readwrite, nonatomic) BOOL preventsAppActivation; @property (readwrite, nonatomic) BOOL floating; @property (readwrite, nonatomic) BOOL drawnSinceShown; @property (readwrite, nonatomic) BOOL closing; @@ -954,7 +955,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
static WineWindow* causing_becomeKeyWindow;
- @synthesize disabled, noForeground, floating, fullscreen, fakingClose, closing, latentParentWindow, hwnd, queue; + @synthesize disabled, noForeground, preventsAppActivation, floating, fullscreen, fakingClose, closing, latentParentWindow, hwnd, queue; @synthesize drawnSinceShown; @synthesize surface, surface_mutex; @synthesize shapeChangedSinceLastDraw; @@ -1143,6 +1144,8 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi NSUInteger currentStyle = [self styleMask]; NSUInteger newStyle = style_mask_for_features(wf) | (currentStyle & ~usedStyles);
+ self.preventsAppActivation = wf->prevents_app_activation; + if (newStyle != currentStyle) { NSString* title = [[[self title] copy] autorelease]; @@ -1686,7 +1689,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi WineWindow* parent; WineWindow* child;
- [controller transformProcessToForeground]; + [controller transformProcessToForeground:!self.preventsAppActivation]; if ([NSApp isHidden]) [NSApp unhide:nil]; wasVisible = [self isVisible]; @@ -2056,7 +2059,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi { if (activate) { - [[WineApplicationController sharedController] transformProcessToForeground]; + [[WineApplicationController sharedController] transformProcessToForeground:YES]; [NSApp activateIgnoringOtherApps:YES]; }