[PATCH 3/9] winemac: Change macdrv_set_view_window_and_frame() to macdrv_set_view_frame().

Ken Thomases ken at codeweavers.com
Thu May 12 18:50:41 CDT 2016


Remove the no-longer-used functionality of potentially moving the view from one
window to another.  That has been taken over by macdrv_set_view_superview().

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
 dlls/winemac.drv/cocoa_window.m | 28 ++++------------------------
 dlls/winemac.drv/macdrv_cocoa.h |  2 +-
 dlls/winemac.drv/opengl.c       |  4 ++--
 3 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 7aba872..d0b92f1 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -3266,39 +3266,22 @@ void macdrv_dispose_view(macdrv_view v)
 }
 
 /***********************************************************************
- *              macdrv_set_view_window_and_frame
- *
- * Move a view to a new window and/or position within its window.  If w
- * is NULL, leave the view in its current window and just change its
- * frame.
+ *              macdrv_set_view_frame
  */
-void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rect)
+void macdrv_set_view_frame(macdrv_view v, CGRect rect)
 {
     NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
     WineContentView* view = (WineContentView*)v;
-    WineWindow* window = (WineWindow*)w;
 
     if (CGRectIsNull(rect)) rect = CGRectZero;
 
     OnMainThread(^{
-        BOOL changedWindow = (window && window != [view window]);
         NSRect newFrame = NSRectFromCGRect(cgrect_mac_from_win(rect));
         NSRect oldFrame = [view frame];
-        BOOL needUpdateWindowForGLSubviews = FALSE;
-
-        if (changedWindow)
-        {
-            WineWindow* oldWindow = (WineWindow*)[view window];
-            [view removeFromSuperview];
-            [oldWindow updateForGLSubviews];
-            [[window contentView] addSubview:view];
-            needUpdateWindowForGLSubviews = TRUE;
-        }
 
         if (!NSEqualRects(oldFrame, newFrame))
         {
-            if (!changedWindow)
-                [[view superview] setNeedsDisplayInRect:oldFrame];
+            [[view superview] setNeedsDisplayInRect:oldFrame];
             if (NSEqualPoints(oldFrame.origin, newFrame.origin))
                 [view setFrameSize:newFrame.size];
             else if (NSEqualSizes(oldFrame.size, newFrame.size))
@@ -3306,17 +3289,14 @@ void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rec
             else
                 [view setFrame:newFrame];
             [view setNeedsDisplay:YES];
-            needUpdateWindowForGLSubviews = TRUE;
 
             if (retina_enabled)
             {
                 int backing_size[2] = { 0 };
                 [view wine_setBackingSize:backing_size];
             }
-        }
-
-        if (needUpdateWindowForGLSubviews)
             [(WineWindow*)[view window] updateForGLSubviews];
+        }
     });
 
     [pool release];
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h
index 6e70d6d..331fca7 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -513,7 +513,7 @@ extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat
 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 void macdrv_dispose_view(macdrv_view v) DECLSPEC_HIDDEN;
-extern void macdrv_set_view_window_and_frame(macdrv_view v, macdrv_window w, CGRect rect) 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;
 extern void macdrv_add_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
 extern void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index 0039f0a..f6a656f 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -1736,7 +1736,7 @@ void set_gl_view_parent(HWND hwnd, HWND parent)
         }
 
         macdrv_set_view_superview(data->gl_view, NULL, cocoa_window, NULL, NULL);
-        macdrv_set_view_window_and_frame(data->gl_view, NULL, cgrect_from_rect(data->gl_rect));
+        macdrv_set_view_frame(data->gl_view, cgrect_from_rect(data->gl_rect));
         mark_contexts_for_moved_view(data->gl_view);
     }
 
@@ -4430,7 +4430,7 @@ void sync_gl_view(struct macdrv_win_data *data)
     if (get_gl_view_window_rect(data, NULL, &rect) && memcmp(&data->gl_rect, &rect, sizeof(rect)))
     {
         TRACE("Setting GL view %p frame to %s\n", data->gl_view, wine_dbgstr_rect(&rect));
-        macdrv_set_view_window_and_frame(data->gl_view, NULL, cgrect_from_rect(rect));
+        macdrv_set_view_frame(data->gl_view, cgrect_from_rect(rect));
         data->gl_rect = rect;
         mark_contexts_for_moved_view(data->gl_view);
     }
-- 
2.6.0




More information about the wine-patches mailing list