Skip to content
Snippets Groups Projects
Commit 9d29ea42 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard
Browse files

winemac: Implement support for no-activate windows.

parent 064186e7
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
{
NSUInteger normalStyleMask;
BOOL disabled;
BOOL noActivate;
}
@end
......@@ -61,6 +61,7 @@ @interface WineContentView : NSView
@interface WineWindow ()
@property (nonatomic) BOOL disabled;
@property (nonatomic) BOOL noActivate;
+ (void) flipRect:(NSRect*)rect;
......@@ -79,7 +80,7 @@ - (BOOL) isFlipped
@implementation WineWindow
@synthesize disabled;
@synthesize disabled, noActivate;
+ (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf
windowFrame:(NSRect)window_frame
......@@ -147,6 +148,7 @@ - (void) setWindowFeatures:(const struct macdrv_window_features*)wf
- (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 @@ - (void) setDisabled:(BOOL)newValue
*/
- (BOOL) canBecomeKeyWindow
{
return !self.disabled;
if (self.disabled || self.noActivate) return NO;
return YES;
}
- (BOOL) canBecomeMainWindow
......
......@@ -127,6 +127,7 @@
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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment