[PATCH 3/5] winemac.drv: Move GL context update code to -viewWillDraw method.

Chip Davis cdavis at codeweavers.com
Tue Aug 31 17:27:35 CDT 2021


One of my goals with this series is getting rid of the -drawRect:
method. We shouldn't need it after we start setting surface contents
directly to layers.

Signed-off-by: Chip Davis <cdavis at codeweavers.com>
---
 dlls/winemac.drv/cocoa_window.m | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 4d7aa570552..3eb8ec20877 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -491,9 +491,9 @@ - (BOOL) isFlipped
         return YES;
     }
 
-    - (void) drawRect:(NSRect)rect
+    - (void) viewWillDraw
     {
-        WineWindow* window = (WineWindow*)[self window];
+        [super viewWillDraw];
 
         for (WineOpenGLContext* context in pendingGlContexts)
         {
@@ -506,6 +506,11 @@ - (void) drawRect:(NSRect)rect
         }
         [glContexts addObjectsFromArray:pendingGlContexts];
         [pendingGlContexts removeAllObjects];
+    }
+
+    - (void) drawRect:(NSRect)rect
+    {
+        WineWindow* window = (WineWindow*)[self window];
 
         if ([window contentView] != self)
             return;
-- 
2.33.0




More information about the wine-devel mailing list