Commit b6544d19 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Implement support for owned windows.

parent 429732ce
......@@ -27,6 +27,7 @@
BOOL disabled;
BOOL noActivate;
BOOL floating;
WineWindow* latentParentWindow;
}
@end
......@@ -63,6 +63,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
@property (nonatomic) BOOL disabled;
@property (nonatomic) BOOL noActivate;
@property (nonatomic) BOOL floating;
@property (retain, nonatomic) NSWindow* latentParentWindow;
+ (void) flipRect:(NSRect*)rect;
......@@ -81,7 +82,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
@implementation WineWindow
@synthesize disabled, noActivate, floating;
@synthesize disabled, noActivate, floating, latentParentWindow;
+ (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf
windowFrame:(NSRect)window_frame
......@@ -119,6 +120,12 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
return window;
}
- (void) dealloc
{
[latentParentWindow release];
[super dealloc];
}
+ (void) flipRect:(NSRect*)rect
{
rect->origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(*rect);
......@@ -172,11 +179,23 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
[self orderWindow:NSWindowBelow relativeTo:[prev windowNumber]];
else
[self orderWindow:NSWindowAbove relativeTo:[next windowNumber]];
if (latentParentWindow)
{
[latentParentWindow addChildWindow:self ordered:NSWindowAbove];
self.latentParentWindow = nil;
}
}
return on_screen;
}
- (void) doOrderOut
{
self.latentParentWindow = [self parentWindow];
[latentParentWindow removeChildWindow:self];
[self orderOut:nil];
}
- (BOOL) setFrameIfOnScreen:(NSRect)contentRect
{
NSArray* screens = [NSScreen screens];
......@@ -193,7 +212,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
{
on_screen = frame_intersects_screens(contentRect, screens);
if (!on_screen)
[self orderOut:nil];
[self doOrderOut];
}
oldFrame = [self frame];
......@@ -209,6 +228,19 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
return on_screen;
}
- (void) setMacDrvParentWindow:(WineWindow*)parent
{
if ([self parentWindow] != parent)
{
[[self parentWindow] removeChildWindow:self];
self.latentParentWindow = nil;
if ([self isVisible] && parent)
[parent addChildWindow:self ordered:NSWindowAbove];
else
self.latentParentWindow = parent;
}
}
- (void) setDisabled:(BOOL)newValue
{
if (disabled != newValue)
......@@ -368,7 +400,7 @@ void macdrv_hide_cocoa_window(macdrv_window w)
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
[window orderOut:nil];
[window doOrderOut];
});
}
......@@ -392,3 +424,18 @@ int macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame)
return on_screen;
}
/***********************************************************************
* macdrv_set_cocoa_parent_window
*
* Sets the parent window for a Cocoa window. If parent is NULL, clears
* the parent window.
*/
void macdrv_set_cocoa_parent_window(macdrv_window w, macdrv_window parent)
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
[window setMacDrvParentWindow:(WineWindow*)parent];
});
}
......@@ -144,5 +144,6 @@ extern int macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev,
macdrv_window next) DECLSPEC_HIDDEN;
extern void macdrv_hide_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN;
extern int macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame) DECLSPEC_HIDDEN;
extern void macdrv_set_cocoa_parent_window(macdrv_window w, macdrv_window parent) DECLSPEC_HIDDEN;
#endif /* __WINE_MACDRV_COCOA_H */
......@@ -301,12 +301,18 @@ static macdrv_window macdrv_get_cocoa_window(HWND hwnd)
static void set_cocoa_window_properties(struct macdrv_win_data *data)
{
DWORD style, ex_style;
HWND owner;
macdrv_window owner_win;
struct macdrv_window_features wf;
struct macdrv_window_state state;
style = GetWindowLongW(data->hwnd, GWL_STYLE);
ex_style = GetWindowLongW(data->hwnd, GWL_EXSTYLE);
owner = GetWindow(data->hwnd, GW_OWNER);
owner_win = macdrv_get_cocoa_window(owner);
macdrv_set_cocoa_parent_window(data->cocoa_window, owner_win);
get_cocoa_window_features(data, style, ex_style, &wf);
macdrv_set_cocoa_window_features(data->cocoa_window, &wf);
......
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