Commit 177b67e6 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Make each Mac driver window track the HWND it's associated with.

parent 207c4d19
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
BOOL floating; BOOL floating;
WineWindow* latentParentWindow; WineWindow* latentParentWindow;
void* hwnd;
WineEventQueue* queue; WineEventQueue* queue;
void* surface; void* surface;
......
...@@ -66,6 +66,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens) ...@@ -66,6 +66,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
@property (nonatomic) BOOL floating; @property (nonatomic) BOOL floating;
@property (retain, nonatomic) NSWindow* latentParentWindow; @property (retain, nonatomic) NSWindow* latentParentWindow;
@property (nonatomic) void* hwnd;
@property (retain, nonatomic) WineEventQueue* queue; @property (retain, nonatomic) WineEventQueue* queue;
@property (nonatomic) void* surface; @property (nonatomic) void* surface;
...@@ -162,7 +163,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens) ...@@ -162,7 +163,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
@implementation WineWindow @implementation WineWindow
@synthesize disabled, noActivate, floating, latentParentWindow, queue; @synthesize disabled, noActivate, floating, latentParentWindow, hwnd, queue;
@synthesize surface, surface_mutex; @synthesize surface, surface_mutex;
@synthesize shape, shapeChangedSinceLastDraw; @synthesize shape, shapeChangedSinceLastDraw;
@synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue; @synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue;
...@@ -170,6 +171,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens) ...@@ -170,6 +171,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
+ (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf
windowFrame:(NSRect)window_frame windowFrame:(NSRect)window_frame
hwnd:(void*)hwnd
queue:(WineEventQueue*)queue queue:(WineEventQueue*)queue
{ {
WineWindow* window; WineWindow* window;
...@@ -195,6 +197,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens) ...@@ -195,6 +197,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
[window setHasShadow:wf->shadow]; [window setHasShadow:wf->shadow];
[window setColorSpace:[NSColorSpace genericRGBColorSpace]]; [window setColorSpace:[NSColorSpace genericRGBColorSpace]];
[window setDelegate:window]; [window setDelegate:window];
window.hwnd = hwnd;
window.queue = queue; window.queue = queue;
contentView = [[[WineContentView alloc] initWithFrame:NSZeroRect] autorelease]; contentView = [[[WineContentView alloc] initWithFrame:NSZeroRect] autorelease];
...@@ -447,13 +450,14 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens) ...@@ -447,13 +450,14 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
* title bar, close box, etc.). * title bar, close box, etc.).
*/ */
macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf, macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf,
CGRect frame, macdrv_event_queue queue) CGRect frame, void* hwnd, macdrv_event_queue queue)
{ {
__block WineWindow* window; __block WineWindow* window;
OnMainThread(^{ OnMainThread(^{
window = [[WineWindow createWindowWithFeatures:wf window = [[WineWindow createWindowWithFeatures:wf
windowFrame:NSRectFromCGRect(frame) windowFrame:NSRectFromCGRect(frame)
hwnd:hwnd
queue:(WineEventQueue*)queue] retain]; queue:(WineEventQueue*)queue] retain];
}); });
...@@ -478,6 +482,17 @@ void macdrv_destroy_cocoa_window(macdrv_window w) ...@@ -478,6 +482,17 @@ void macdrv_destroy_cocoa_window(macdrv_window w)
} }
/*********************************************************************** /***********************************************************************
* macdrv_get_window_hwnd
*
* Get the hwnd that was set for the window at creation.
*/
void* macdrv_get_window_hwnd(macdrv_window w)
{
WineWindow* window = (WineWindow*)w;
return window.hwnd;
}
/***********************************************************************
* macdrv_set_cocoa_window_features * macdrv_set_cocoa_window_features
* *
* Update a Cocoa window's features. * Update a Cocoa window's features.
......
...@@ -161,7 +161,7 @@ struct macdrv_window_state { ...@@ -161,7 +161,7 @@ struct macdrv_window_state {
}; };
extern macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf, extern macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf,
CGRect frame, macdrv_event_queue queue) DECLSPEC_HIDDEN; CGRect frame, void* hwnd, macdrv_event_queue queue) DECLSPEC_HIDDEN;
extern void macdrv_destroy_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN; extern void macdrv_destroy_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN;
extern void* macdrv_get_window_hwnd(macdrv_window w) DECLSPEC_HIDDEN; extern void* macdrv_get_window_hwnd(macdrv_window w) DECLSPEC_HIDDEN;
extern void macdrv_set_cocoa_window_features(macdrv_window w, extern void macdrv_set_cocoa_window_features(macdrv_window w,
......
...@@ -511,7 +511,7 @@ static void create_cocoa_window(struct macdrv_win_data *data) ...@@ -511,7 +511,7 @@ static void create_cocoa_window(struct macdrv_win_data *data)
TRACE("creating %p window %s whole %s client %s\n", data->hwnd, wine_dbgstr_rect(&data->window_rect), TRACE("creating %p window %s whole %s client %s\n", data->hwnd, wine_dbgstr_rect(&data->window_rect),
wine_dbgstr_rect(&data->whole_rect), wine_dbgstr_rect(&data->client_rect)); wine_dbgstr_rect(&data->whole_rect), wine_dbgstr_rect(&data->client_rect));
data->cocoa_window = macdrv_create_cocoa_window(&wf, frame, thread_data->queue); data->cocoa_window = macdrv_create_cocoa_window(&wf, frame, data->hwnd, thread_data->queue);
if (!data->cocoa_window) goto done; if (!data->cocoa_window) goto done;
set_cocoa_window_properties(data); set_cocoa_window_properties(data);
......
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