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

This commit is contained in:
Ken Thomases 2013-01-21 00:08:03 -06:00 committed by Alexandre Julliard
parent 207c4d193f
commit 177b67e6bd
4 changed files with 20 additions and 4 deletions

View File

@ -32,6 +32,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
BOOL floating;
WineWindow* latentParentWindow;
void* hwnd;
WineEventQueue* queue;
void* surface;

View File

@ -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
*

View File

@ -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,

View File

@ -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);