Ken Thomases : winemac: Change macdrv_create_view() to not add the new view to a window's content view.

Alexandre Julliard julliard at wine.codeweavers.com
Sat May 14 10:07:28 CDT 2016


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Thu May 12 18:50:43 2016 -0500

winemac: Change macdrv_create_view() to not add the new view to a window's content view.

Callers can use macdrv_set_view_superview() to do that separately.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/cocoa_window.m | 7 ++-----
 dlls/winemac.drv/macdrv_cocoa.h | 2 +-
 dlls/winemac.drv/opengl.c       | 3 ++-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 29c6de9..d97eb1d 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -3212,14 +3212,13 @@ void macdrv_set_window_min_max_sizes(macdrv_window w, CGSize min_size, CGSize ma
 /***********************************************************************
  *              macdrv_create_view
  *
- * Creates and returns a view in the specified rect of the window.  The
+ * Creates and returns a view with the specified frame rect.  The
  * caller is responsible for calling macdrv_dispose_view() on the view
  * when it is done with it.
  */
-macdrv_view macdrv_create_view(macdrv_window w, CGRect rect)
+macdrv_view macdrv_create_view(CGRect rect)
 {
     NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-    WineWindow* window = (WineWindow*)w;
     __block WineContentView* view;
 
     if (CGRectIsNull(rect)) rect = CGRectZero;
@@ -3238,8 +3237,6 @@ macdrv_view macdrv_create_view(macdrv_window w, CGRect rect)
                selector:@selector(updateGLContexts)
                    name:NSApplicationDidChangeScreenParametersNotification
                  object:NSApp];
-        [[window contentView] addSubview:view];
-        [window updateForGLSubviews];
     });
 
     [pool release];
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h
index d422985..b3e9106 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -511,7 +511,7 @@ extern void macdrv_clear_window_color_key(macdrv_window w) DECLSPEC_HIDDEN;
 extern void macdrv_window_use_per_pixel_alpha(macdrv_window w, int use_per_pixel_alpha) DECLSPEC_HIDDEN;
 extern void macdrv_give_cocoa_window_focus(macdrv_window w, int activate) DECLSPEC_HIDDEN;
 extern void macdrv_set_window_min_max_sizes(macdrv_window w, CGSize min_size, CGSize max_size) DECLSPEC_HIDDEN;
-extern macdrv_view macdrv_create_view(macdrv_window w, CGRect rect) DECLSPEC_HIDDEN;
+extern macdrv_view macdrv_create_view(CGRect rect) DECLSPEC_HIDDEN;
 extern void macdrv_dispose_view(macdrv_view v) DECLSPEC_HIDDEN;
 extern void macdrv_set_view_frame(macdrv_view v, CGRect rect) DECLSPEC_HIDDEN;
 extern void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, macdrv_view p, macdrv_view n) DECLSPEC_HIDDEN;
diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index ed96c7d..0e067d4 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -1600,13 +1600,14 @@ static BOOL set_win_format(struct macdrv_win_data *data, int format)
             return FALSE;
         }
 
-        data->gl_view = macdrv_create_view(cocoa_window, cgrect_from_rect(data->gl_rect));
+        data->gl_view = macdrv_create_view(cgrect_from_rect(data->gl_rect));
         if (!data->gl_view)
         {
             WARN("failed to create GL view for window %p rect %s\n", cocoa_window, wine_dbgstr_rect(&data->gl_rect));
             return FALSE;
         }
         macdrv_set_view_hidden(data->gl_view, FALSE);
+        macdrv_set_view_superview(data->gl_view, NULL, cocoa_window, NULL, NULL);
 
         TRACE("created GL view %p in window %p at %s\n", data->gl_view, cocoa_window,
               wine_dbgstr_rect(&data->gl_rect));




More information about the wine-cvs mailing list