gdkwindow-quartz: partial aspect ratio support
authorTom Schoonjans <Tom.Schoonjans@bam.de>
Mon, 6 Jul 2015 15:34:37 +0000 (17:34 +0200)
committerJohn Ralls <jralls@ceridwen.us>
Tue, 7 Jul 2015 16:36:29 +0000 (09:36 -0700)
Support was added for GDK_HINT_ASPECT in
gdk_quartz_window_set_geometry_hints though with one restriction:
min_aspect and max_aspect have to be equal, which I believe corresponds
to the most common usage. A warning will be printed if this condition is
not met but min_aspect will be used anyway.

gdk/quartz/gdkwindow-quartz.c

index b77be34f31672375b13ab32fbc6e0d19072aa368..f05ab9469f62611f72004727f34310aee8d91958 100644 (file)
@@ -1863,7 +1863,17 @@ gdk_quartz_window_set_geometry_hints (GdkWindow         *window,
   
   if (geom_mask & GDK_HINT_ASPECT)
     {
-      /* FIXME: Implement */
+      NSSize size;
+
+      if (geometry->min_aspect != geometry->max_aspect)
+        {
+          g_warning ("Only equal minimum and maximum aspect ratios are supported on Mac OS. Using minimum aspect ratio...");
+        }
+
+      size.width = geometry->min_aspect;
+      size.height = 1.0;
+
+      [impl->toplevel setContentAspectRatio:size];
     }
 
   if (geom_mask & GDK_HINT_WIN_GRAVITY)