[gtk+] Quartz: Implement gdk_window_set_functions



commit 8531ee4c884cdb52692447451352cb05fba97b00
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 5 22:52:03 2017 -0500

    Quartz: Implement gdk_window_set_functions
    
    This is useful, and easy to implement.

 gdk/quartz/gdkwindow-quartz.c |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 5f3efd8..803d3b9 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -2324,9 +2324,47 @@ static void
 gdk_quartz_window_set_functions (GdkWindow    *window,
                                  GdkWMFunction functions)
 {
+  GdkWindowImplQuartz *impl;
+  gboolean min, max, close;
+
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  /* FIXME: Implement */
+  imple = GDK_WINDOW_IMPL_QUARTZ (window->impl);
+
+  if (functions & GDK_FUNC_ALL)
+    {
+      min = !(functions & GDK_FUNC_MINIMIZE);
+      max = !(functions & GDK_FUNC_MAXIMIZE);
+      close = !(functions & GDK_FUNC_CLOSE);
+    }
+  else
+    {
+      min = (functions & GDK_FUNC_MINIMIZE);
+      max = (functions & GDK_FUNC_MAXIMIZE);
+      close = (functions & GDK_FUNC_CLOSE);
+    }
+
+  if (impl->toplevel)
+    {
+      NSWindowStyleMask mask = [impl->toplevel styleMask];
+
+      if (min)
+        mask = mask | NSMiniaturizableWindowMask;
+      else
+        mask = mask & ~NSMiniaturizableWindowMask;
+
+      if (max)
+        mask = mask | NSResizableWindowMask;
+      else
+        mask = mask & ~NSResizableWindowMask;
+
+      if (close)
+        mask = mask | NSClosableWindowMask;
+      else
+        mask = mask & ~NSClosableWindowMask;
+
+      [impl->toplevel setStyleMask:mask];
+    }
 }
 
 static void


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