macos: fix scale on macOS 12 beta
authorChristian Hergert <chergert@redhat.com>
Thu, 14 Oct 2021 21:46:30 +0000 (14:46 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 31 Oct 2021 21:52:05 +0000 (17:52 -0400)
This is a port of the fix in the quartz backend to the new macOS backend.

From the original commit:

In macOS-12.sdk CGContextConverSizeToDeviceSpace returns a negative
height and passing that to CGContextScaleCTM in turn causes the cairo
surface to draw outside the window where it can't be seen. Passing the
absolute values of the scale factors fixes the display on macOS 12 without
affecting earlier macOS versions.

gdk/macos/gdkmacossurface.c

index 88be1f513de7e81fccb1733c51bf9bc45c8ec0ec..b8068ecded2eb2916d79916fb60a397a0e4d2a4c 100644 (file)
@@ -807,7 +807,7 @@ _gdk_macos_surface_acquire_context (GdkMacosSurface *self,
       scale = CGSizeMake (1.0, 1.0);
       scale = CGContextConvertSizeToDeviceSpace (cg_context, scale);
 
-      CGContextScaleCTM (cg_context, 1.0 / scale.width, 1.0 / scale.height);
+      CGContextScaleCTM (cg_context, 1.0 / fabs (scale.width), 1.0 / fabs (scale.height));
     }
 
   return cg_context;