[gtk+/wip/attachment-parameters: 2/18] gdkwindow-quartz: implement gdk_quartz_window_set_attachment_parameters ()



commit 04080320ea33db442bda84222d4f3e2f2d4a5950
Author: William Hua <william hua canonical com>
Date:   Thu Oct 1 09:47:38 2015 -0400

    gdkwindow-quartz: implement gdk_quartz_window_set_attachment_parameters ()

 gdk/quartz/gdkwindow-quartz.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 62710a2..f4e3615 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -28,6 +28,7 @@
 #include "gdkglcontext-quartz.h"
 #include "gdkquartzscreen.h"
 #include "gdkquartzcursor.h"
+#include "gdkattachmentparametersprivate.h"
 
 #include <Carbon/Carbon.h>
 #include <AvailabilityMacros.h>
@@ -2873,6 +2874,38 @@ gdk_quartz_window_get_scale_factor (GdkWindow *window)
 }
 
 static void
+gdk_quartz_window_set_attachment_parameters (GdkWindow                     *window,
+                                             const GdkAttachmentParameters *parameters)
+{
+  GdkPoint position;
+  GdkPoint offset;
+  GdkAttachmentOption primary_option;
+  GdkAttachmentOption secondary_option;
+
+  if (!parameters || !parameters->has_attachment_rectangle)
+    return;
+
+  if (gdk_attachment_parameters_choose_position_for_window (parameters,
+                                                            window,
+                                                            &position,
+                                                            &offset,
+                                                            &primary_option,
+                                                            &secondary_option))
+    {
+      gdk_window_move (window, position.x, position.y);
+
+      if (parameters->position_callback)
+        parameters->position_callback (window,
+                                       parameters,
+                                       &position,
+                                       &offset,
+                                       primary_option,
+                                       secondary_option,
+                                       parameters->position_callback_user_data);
+    }
+}
+
+static void
 gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -2958,6 +2991,7 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
   impl_class->delete_property = _gdk_quartz_window_delete_property;
 
   impl_class->create_gl_context = gdk_quartz_window_create_gl_context;
+  impl_class->set_attachment_parameters = gdk_quartz_window_set_attachment_parameters;
 
   impl_quartz_class->get_context = gdk_window_impl_quartz_get_context;
   impl_quartz_class->release_context = gdk_window_impl_quartz_release_context;


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