mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
winemac: Implement support for no-activate windows.
This commit is contained in:
parent
064186e739
commit
9d29ea42e1
@ -25,6 +25,7 @@
|
||||
{
|
||||
NSUInteger normalStyleMask;
|
||||
BOOL disabled;
|
||||
BOOL noActivate;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -61,6 +61,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
|
||||
@interface WineWindow ()
|
||||
|
||||
@property (nonatomic) BOOL disabled;
|
||||
@property (nonatomic) BOOL noActivate;
|
||||
|
||||
+ (void) flipRect:(NSRect*)rect;
|
||||
|
||||
@ -79,7 +80,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
|
||||
|
||||
@implementation WineWindow
|
||||
|
||||
@synthesize disabled;
|
||||
@synthesize disabled, noActivate;
|
||||
|
||||
+ (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf
|
||||
windowFrame:(NSRect)window_frame
|
||||
@ -147,6 +148,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
|
||||
- (void) setMacDrvState:(const struct macdrv_window_state*)state
|
||||
{
|
||||
self.disabled = state->disabled;
|
||||
self.noActivate = state->no_activate;
|
||||
}
|
||||
|
||||
/* Returns whether or not the window was ordered in, which depends on if
|
||||
@ -214,7 +216,8 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
|
||||
*/
|
||||
- (BOOL) canBecomeKeyWindow
|
||||
{
|
||||
return !self.disabled;
|
||||
if (self.disabled || self.noActivate) return NO;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) canBecomeMainWindow
|
||||
|
@ -127,6 +127,7 @@ struct macdrv_window_features {
|
||||
|
||||
struct macdrv_window_state {
|
||||
unsigned int disabled:1;
|
||||
unsigned int no_activate:1;
|
||||
};
|
||||
|
||||
extern macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf,
|
||||
|
@ -73,6 +73,26 @@ static void get_cocoa_window_features(struct macdrv_win_data *data,
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* can_activate_window
|
||||
*
|
||||
* Check if we can activate the specified window.
|
||||
*/
|
||||
static inline BOOL can_activate_window(HWND hwnd)
|
||||
{
|
||||
LONG style = GetWindowLongW(hwnd, GWL_STYLE);
|
||||
RECT rect;
|
||||
|
||||
if (!(style & WS_VISIBLE)) return FALSE;
|
||||
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
|
||||
if (style & WS_MINIMIZE) return FALSE;
|
||||
if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_NOACTIVATE) return FALSE;
|
||||
if (hwnd == GetDesktopWindow()) return FALSE;
|
||||
if (GetWindowRect(hwnd, &rect) && IsRectEmpty(&rect)) return FALSE;
|
||||
return !(style & WS_DISABLED);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* get_cocoa_window_state
|
||||
*/
|
||||
@ -82,6 +102,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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user