[gtk+/wip/attachment-rectangle] x11: make dummy point and use that instead



commit 3402a40b918cc26429d1372ebb84317a936a29f8
Author: William Hua <william hua canonical com>
Date:   Fri Aug 28 22:48:56 2015 +0100

    x11: make dummy point and use that instead

 gdk/x11/gdkwindow-x11.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index a6301a1..3d47a99 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -5688,39 +5688,37 @@ gdk_x11_window_set_attachment_rectangle (GdkWindow            *window,
                                          GdkAttachmentOptions  options)
 {
   GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
+  GdkPoint zero = { 0 };
   gint x;
   gint y;
 
   if (!rect)
     return;
 
+  if (!origin)
+    origin = &zero;
+
   switch (options & GDK_ATTACHMENT_ATTACH_MASK)
     {
     case GDK_ATTACHMENT_ATTACH_TOP_EDGE:
-      x = rect->x;
-      y = rect->y - gdk_window_get_height (window);
+      x = origin->x + rect->x;
+      y = origin->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;
+      x = origin->x + rect->x - gdk_window_get_width (window);
+      y = origin->y + rect->y;
       break;
     case GDK_ATTACHMENT_ATTACH_RIGHT_EDGE:
-      x = rect->x + rect->width;
-      y = rect->y;
+      x = origin->x + rect->x + rect->width;
+      y = origin->y + rect->y;
       break;
     case GDK_ATTACHMENT_ATTACH_BOTTOM_EDGE:
     case GDK_ATTACHMENT_ATTACH_ANY_EDGE:
-      x = rect->x;
-      y = rect->y + rect->height;
+      x = origin->x + rect->x;
+      y = origin->y + rect->y + rect->height;
       break;
     }
 
-  if (origin)
-    {
-      x += origin->x;
-      y += origin->y;
-    }
-
   if (impl->toplevel && !impl->toplevel->actually_mapped)
     {
       impl->toplevel->initial_position.x = x;


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