[gtk+] gdkwindow-quartz: partial aspect ratio support



commit 7d43cda4934779e7529a905db2762a92eeda2f0b
Author: Tom Schoonjans <Tom Schoonjans bam de>
Date:   Mon Jul 6 17:34:37 2015 +0200

    gdkwindow-quartz: partial aspect ratio support
    
    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 |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index b77be34..f05ab94 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]