Ken Thomases : winemac: Don't remove an OpenGL context from its view if we 're only going to re-add it.

Alexandre Julliard julliard at winehq.org
Tue Jan 14 13:44:59 CST 2014


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Tue Jan 14 01:25:05 2014 -0600

winemac: Don't remove an OpenGL context from its view if we're only going to re-add it.

If the context is being made current with its existing view, just update it
before making it current.

---

 dlls/winemac.drv/cocoa_opengl.m |   29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m
index 196da46..5ec5688 100644
--- a/dlls/winemac.drv/cocoa_opengl.m
+++ b/dlls/winemac.drv/cocoa_opengl.m
@@ -156,20 +156,25 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
 
     if (context && view)
     {
-        [context removeFromViews:NO];
-        macdrv_add_view_opengl_context(v, c);
-
-        if (context.needsUpdate)
-        {
-            context.needsUpdate = FALSE;
-            [context setView:view];
-            [context setLatentView:nil];
-        }
+        if (view == [context view] || view == [context latentView])
+            macdrv_update_opengl_context(c);
         else
         {
-            if ([context view])
-                [context clearDrawableLeavingSurfaceOnScreen];
-            [context setLatentView:view];
+            [context removeFromViews:NO];
+            macdrv_add_view_opengl_context(v, c);
+
+            if (context.needsUpdate)
+            {
+                context.needsUpdate = FALSE;
+                [context setView:view];
+                [context setLatentView:nil];
+            }
+            else
+            {
+                if ([context view])
+                    [context clearDrawableLeavingSurfaceOnScreen];
+                [context setLatentView:view];
+            }
         }
 
         [context makeCurrentContext];




More information about the wine-cvs mailing list