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

Ken Thomases ken at codeweavers.com
Wed May 18 18:38:25 CDT 2016


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

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
I missed this in <http://source.winehq.org/git/wine.git/?a=commit;h=d91e568635c7cd23bd56f3ed688a2ba0b7219097>.

 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 @@ - (void) wine_setBackingSize:(const int*)newBackingSize
         }
     }
 
+    - (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 @@ - (void) setRetinaMode:(int)mode
         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];
-- 
2.8.2




More information about the wine-patches mailing list