[gtk+/wip/attachment-parameters: 1/18] gdkwindow-broadway: implement gdk_broadway_window_set_attachment_parameters ()



commit 2b36f7f6663252af3bb386291a7f112be0732a56
Author: William Hua <william hua canonical com>
Date:   Mon Sep 28 16:49:47 2015 -0400

    gdkwindow-broadway: implement gdk_broadway_window_set_attachment_parameters ()

 gdk/broadway/gdkwindow-broadway.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index ebde1b9..60be8aa 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -37,6 +37,7 @@
 #include "gdkinternals.h"
 #include "gdkdeviceprivate.h"
 #include "gdkeventsource.h"
+#include "gdkattachmentparametersprivate.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -1545,6 +1546,38 @@ gdk_broadway_get_last_seen_time (GdkWindow  *window)
 }
 
 static void
+gdk_broadway_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_broadway_class_init (GdkWindowImplBroadwayClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1626,4 +1659,5 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
   impl_class->change_property = _gdk_broadway_window_change_property;
   impl_class->delete_property = _gdk_broadway_window_delete_property;
   impl_class->get_drag_protocol = _gdk_broadway_window_get_drag_protocol;
+  impl_class->set_attachment_parameters = gdk_broadway_window_set_attachment_parameters;
 }


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