Commit 4b4ebef4 authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

winemac.drv: Allow foregrounding WS_EX_NOACTIVATE windows.

The previous behavior denies any attempt to focus such windows, which is not in line with how they behave on Windows. Rename the macdrv_window_state no_activate field to no_foreground so it more accurately reflects its meaning. Signed-off-by: 's avatarTim Clem <tclem@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b59335af
......@@ -1864,7 +1864,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
break;
}
}
if (!process && ![windowBroughtForward isKeyWindow] && !windowBroughtForward.disabled && !windowBroughtForward.noActivate)
if (!process && ![windowBroughtForward isKeyWindow] && !windowBroughtForward.disabled && !windowBroughtForward.noForeground)
[self windowGotFocus:windowBroughtForward];
}
......
......@@ -27,7 +27,7 @@
@interface WineWindow : NSPanel <NSWindowDelegate>
{
BOOL disabled;
BOOL noActivate;
BOOL noForeground;
BOOL floating;
BOOL resizable;
BOOL maximized;
......@@ -90,7 +90,7 @@
@property (retain, readonly, nonatomic) WineEventQueue* queue;
@property (readonly, nonatomic) BOOL disabled;
@property (readonly, nonatomic) BOOL noActivate;
@property (readonly, nonatomic) BOOL noForeground;
@property (readonly, nonatomic) BOOL floating;
@property (readonly, getter=isFullscreen, nonatomic) BOOL fullscreen;
@property (readonly, getter=isFakingClose, nonatomic) BOOL fakingClose;
......
......@@ -378,7 +378,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
@interface WineWindow ()
@property (readwrite, nonatomic) BOOL disabled;
@property (readwrite, nonatomic) BOOL noActivate;
@property (readwrite, nonatomic) BOOL noForeground;
@property (readwrite, nonatomic) BOOL floating;
@property (readwrite, nonatomic) BOOL drawnSinceShown;
@property (readwrite, nonatomic) BOOL closing;
......@@ -942,7 +942,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
static WineWindow* causing_becomeKeyWindow;
@synthesize disabled, noActivate, floating, fullscreen, fakingClose, closing, latentParentWindow, hwnd, queue;
@synthesize disabled, noForeground, floating, fullscreen, fakingClose, closing, latentParentWindow, hwnd, queue;
@synthesize drawnSinceShown;
@synthesize surface, surface_mutex;
@synthesize shapeChangedSinceLastDraw;
......@@ -1232,7 +1232,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
NSWindowCollectionBehavior behavior;
self.disabled = state->disabled;
self.noActivate = state->no_activate;
self.noForeground = state->no_foreground;
if (self.floating != state->floating)
{
......@@ -2338,7 +2338,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (BOOL) canBecomeKeyWindow
{
if (causing_becomeKeyWindow == self) return YES;
if (self.disabled || self.noActivate) return NO;
if (self.disabled || self.noForeground) return NO;
if ([self isKeyWindow]) return YES;
// If a window's collectionBehavior says it participates in cycling,
......@@ -2406,7 +2406,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
BOOL ret = [super validateMenuItem:menuItem];
if ([menuItem action] == @selector(makeKeyAndOrderFront:))
ret = [self isKeyWindow] || (!self.disabled && !self.noActivate);
ret = [self isKeyWindow] || (!self.disabled && !self.noForeground);
if ([menuItem action] == @selector(toggleFullScreen:) && (self.disabled || maximized))
ret = NO;
......@@ -2421,7 +2421,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
[self orderBelow:nil orAbove:nil activate:NO];
[[self ancestorWineWindow] postBroughtForwardEvent];
if (![self isKeyWindow] && !self.disabled && !self.noActivate)
if (![self isKeyWindow] && !self.disabled && !self.noForeground)
[[WineApplicationController sharedController] windowGotFocus:self];
}
......@@ -2815,7 +2815,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
if (![self parentWindow])
[self postBroughtForwardEvent];
if (!self.disabled && !self.noActivate)
if (!self.disabled && !self.noForeground)
{
causing_becomeKeyWindow = self;
[self makeKeyWindow];
......
......@@ -542,7 +542,7 @@ struct macdrv_window_features {
struct macdrv_window_state {
unsigned int disabled:1;
unsigned int no_activate:1;
unsigned int no_foreground:1;
unsigned int floating:1;
unsigned int excluded_by_expose:1;
unsigned int excluded_by_cycle:1;
......
......@@ -90,17 +90,17 @@ static void get_cocoa_window_features(struct macdrv_win_data *data,
/*******************************************************************
* can_activate_window
* can_window_become_foreground
*
* Check if we can activate the specified window.
* Check if the specified window can become the foreground/key
* window.
*/
static inline BOOL can_activate_window(HWND hwnd)
static inline BOOL can_window_become_foreground(HWND hwnd)
{
LONG style = GetWindowLongW(hwnd, GWL_STYLE);
if (!(style & WS_VISIBLE)) return FALSE;
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_NOACTIVATE) return FALSE;
if (hwnd == GetDesktopWindow()) return FALSE;
return !(style & WS_DISABLED);
}
......@@ -115,7 +115,7 @@ static void get_cocoa_window_state(struct macdrv_win_data *data,
{
memset(state, 0, sizeof(*state));
state->disabled = (style & WS_DISABLED) != 0;
state->no_activate = !can_activate_window(data->hwnd);
state->no_foreground = !can_window_become_foreground(data->hwnd);
state->floating = (ex_style & WS_EX_TOPMOST) != 0;
state->excluded_by_expose = state->excluded_by_cycle =
(!(ex_style & WS_EX_APPWINDOW) &&
......@@ -2347,7 +2347,7 @@ void macdrv_window_got_focus(HWND hwnd, const macdrv_event *event)
hwnd, event->window, event->window_got_focus.serial, IsWindowEnabled(hwnd),
IsWindowVisible(hwnd), style, GetFocus(), GetActiveWindow(), GetForegroundWindow());
if (can_activate_window(hwnd) && !(style & WS_MINIMIZE))
if (can_window_become_foreground(hwnd) && !(style & WS_MINIMIZE))
{
/* simulate a mouse click on the menu to find out
* whether the window wants to be activated */
......@@ -2570,7 +2570,7 @@ void macdrv_window_drag_begin(HWND hwnd, const macdrv_event *event)
data->drag_event = drag_event;
release_win_data(data);
if (!event->window_drag_begin.no_activate && can_activate_window(hwnd) && GetForegroundWindow() != hwnd)
if (!event->window_drag_begin.no_activate && can_window_become_foreground(hwnd) && GetForegroundWindow() != hwnd)
{
/* ask whether the window wants to be activated */
LRESULT ma = SendMessageW(hwnd, WM_MOUSEACTIVATE, (WPARAM)GetAncestor(hwnd, GA_ROOT),
......
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