diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h index e1e59f477b0..1f81cc675c5 100644 --- a/dlls/winemac.drv/cocoa_window.h +++ b/dlls/winemac.drv/cocoa_window.h @@ -32,6 +32,7 @@ @interface WineWindow : NSPanel BOOL floating; WineWindow* latentParentWindow; + void* hwnd; WineEventQueue* queue; void* surface; diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 4ca7a092b3e..e647cd02eb2 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -66,6 +66,7 @@ @interface WineWindow () @property (nonatomic) BOOL floating; @property (retain, nonatomic) NSWindow* latentParentWindow; +@property (nonatomic) void* hwnd; @property (retain, nonatomic) WineEventQueue* queue; @property (nonatomic) void* surface; @@ -162,7 +163,7 @@ - (void) drawRect:(NSRect)rect @implementation WineWindow - @synthesize disabled, noActivate, floating, latentParentWindow, queue; + @synthesize disabled, noActivate, floating, latentParentWindow, hwnd, queue; @synthesize surface, surface_mutex; @synthesize shape, shapeChangedSinceLastDraw; @synthesize colorKeyed, colorKeyRed, colorKeyGreen, colorKeyBlue; @@ -170,6 +171,7 @@ @implementation WineWindow + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf windowFrame:(NSRect)window_frame + hwnd:(void*)hwnd queue:(WineEventQueue*)queue { WineWindow* window; @@ -195,6 +197,7 @@ + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)w [window setHasShadow:wf->shadow]; [window setColorSpace:[NSColorSpace genericRGBColorSpace]]; [window setDelegate:window]; + window.hwnd = hwnd; window.queue = queue; contentView = [[[WineContentView alloc] initWithFrame:NSZeroRect] autorelease]; @@ -447,13 +450,14 @@ - (BOOL)windowShouldClose:(id)sender * title bar, close box, etc.). */ 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; OnMainThread(^{ window = [[WineWindow createWindowWithFeatures:wf windowFrame:NSRectFromCGRect(frame) + hwnd:hwnd queue:(WineEventQueue*)queue] retain]; }); @@ -477,6 +481,17 @@ void macdrv_destroy_cocoa_window(macdrv_window w) [pool release]; } +/*********************************************************************** + * 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 * diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 71b4c3295cc..31bbb2d0b10 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -161,7 +161,7 @@ extern int macdrv_get_event_from_queue(macdrv_event_queue queue, }; 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_get_window_hwnd(macdrv_window w) DECLSPEC_HIDDEN; extern void macdrv_set_cocoa_window_features(macdrv_window w, diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 26dedf4ad2c..cd7be9e670c 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -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), 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; set_cocoa_window_properties(data);