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

Alexandre Julliard julliard at winehq.org
Mon Jan 21 13:52:23 CST 2013


Module: wine
Branch: master
Commit: 177b67e6bd456d69cce687245e5773015ac3fee5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=177b67e6bd456d69cce687245e5773015ac3fee5

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Jan 21 00:08:03 2013 -0600

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

---

 dlls/winemac.drv/cocoa_window.h |    1 +
 dlls/winemac.drv/cocoa_window.m |   19 +++++++++++++++++--
 dlls/winemac.drv/macdrv_cocoa.h |    2 +-
 dlls/winemac.drv/window.c       |    2 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h
index e1e59f4..1f81cc6 100644
--- a/dlls/winemac.drv/cocoa_window.h
+++ b/dlls/winemac.drv/cocoa_window.h
@@ -32,6 +32,7 @@
     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 4ca7a09..e647cd0 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -66,6 +66,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
 @property (nonatomic) BOOL floating;
 @property (retain, nonatomic) NSWindow* latentParentWindow;
 
+ at property (nonatomic) void* hwnd;
 @property (retain, nonatomic) WineEventQueue* queue;
 
 @property (nonatomic) void* surface;
@@ -162,7 +163,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
 
 @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 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
 
     + (WineWindow*) createWindowWithFeatures:(const struct macdrv_window_features*)wf
                                  windowFrame:(NSRect)window_frame
+                                        hwnd:(void*)hwnd
                                        queue:(WineEventQueue*)queue
     {
         WineWindow* window;
@@ -195,6 +197,7 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
         [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 @@ static BOOL frame_intersects_screens(NSRect frame, NSArray* screens)
  * 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];
     });
 
@@ -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
  *
  * Update a Cocoa window's features.
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h
index 71b4c32..31bbb2d 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -161,7 +161,7 @@ struct macdrv_window_state {
 };
 
 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 26dedf4..cd7be9e 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);




More information about the wine-cvs mailing list