[gtk+/wip/attachment-rectangle] x11: use attachment options for positioning



commit 5108233dc78e3edba723ee661099858f15f65437
Author: William Hua <william hua canonical com>
Date:   Tue Aug 25 16:09:33 2015 +0100

    x11: use attachment options for positioning

 gdk/x11/gdkwindow-x11.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 7fae928..30750e1 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -5693,8 +5693,25 @@ gdk_x11_window_set_attachment_rectangle (GdkWindow            *window,
   if (!rect)
     return;
 
-  x = rect->x;
-  y = rect->y + rect->height;
+  switch (options & GDK_ATTACHMENT_ATTACH_MASK)
+    {
+    case GDK_ATTACHMENT_ATTACH_TOP_EDGE:
+      x = rect->x;
+      y = rect->y - gdk_window_get_height (window);
+      break;
+    case GDK_ATTACHMENT_ATTACH_LEFT_EDGE:
+      x = rect->x - gdk_window_get_width (window);
+      y = rect->y;
+      break;
+    case GDK_ATTACHMENT_ATTACH_RIGHT_EDGE:
+      x = rect->x + rect->width;
+      y = rect->y;
+      break;
+    case GDK_ATTACHMENT_ATTACH_BOTTOM_EDGE:
+      x = rect->x;
+      y = rect->y + rect->height;
+      break;
+    }
 
   if (origin)
     {


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