Ken Thomases : winemac: Adjust sizes of all descendant views when Retina mode changes.

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 19 10:32:07 CDT 2016


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed May 18 18:38:25 2016 -0500

winemac: Adjust sizes of all descendant views when Retina mode changes.

As opposed to just the immediate subviews of the window contentView.

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

---

 dlls/winemac.drv/cocoa_window.m | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index d97eb1d..1b0f9cc 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -553,6 +553,24 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
         }
     }
 
+    - (void) setRetinaMode:(int)mode
+    {
+        double scale = mode ? 0.5 : 2.0;
+        NSRect frame = self.frame;
+        frame.origin.x *= scale;
+        frame.origin.y *= scale;
+        frame.size.width *= scale;
+        frame.size.height *= scale;
+        [self setFrame:frame];
+        [self updateGLContexts];
+
+        for (WineContentView* subview in [self subviews])
+        {
+            if ([subview isKindOfClass:[WineContentView class]])
+                [subview setRetinaMode:mode];
+        }
+    }
+
     - (BOOL) acceptsFirstMouse:(NSEvent*)theEvent
     {
         return YES;
@@ -2301,15 +2319,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
         for (WineContentView* subview in [self.contentView subviews])
         {
             if ([subview isKindOfClass:[WineContentView class]])
-            {
-                frame = subview.frame;
-                frame.origin.x *= scale;
-                frame.origin.y *= scale;
-                frame.size.width *= scale;
-                frame.size.height *= scale;
-                [subview setFrame:frame];
-                [subview updateGLContexts];
-            }
+                [subview setRetinaMode:mode];
         }
 
         frame = [self contentRectForFrameRect:self.wine_fractionalFrame];




More information about the wine-cvs mailing list