changeset 67530:5b6c71adc503

* (compute_tip_xy): Calculate root_y the same way as root_x, i.e. dy is offset from top of frame instead of bottom.
author Jan Djärv <jan.h.d@swipnet.se>
date Mon, 12 Dec 2005 09:32:59 +0000
parents dcb511f8ef75
children 525cba59adb2
files src/macfns.c src/w32fns.c src/xfns.c
diffstat 3 files changed, 24 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/macfns.c	Mon Dec 12 09:32:15 2005 +0000
+++ b/src/macfns.c	Mon Dec 12 09:32:59 2005 +0000
@@ -3840,13 +3840,15 @@
 
   if (INTEGERP (top))
     *root_y = XINT (top);
-  else if (*root_y + XINT (dy) - height < 0)
-    *root_y -= XINT (dy);
+  else if (*root_y + XINT (dy) + height <= FRAME_MAC_DISPLAY_INFO (f)->height)
+    /* It fits below the pointer */
+      *root_y += XINT (dy);
+  else if (height + XINT (dy) <= *root_y)
+    /* It fits above the pointer.  */
+    *root_y -= height + XINT (dy);
   else
-    {
-      *root_y -= height;
-      *root_y += XINT (dy);
-    }
+    /* Put it on the top.  */
+    *root_y = 0;
 
   if (INTEGERP (left))
     *root_x = XINT (left);
--- a/src/w32fns.c	Mon Dec 12 09:32:15 2005 +0000
+++ b/src/w32fns.c	Mon Dec 12 09:32:59 2005 +0000
@@ -7411,16 +7411,15 @@
 
   if (INTEGERP (top))
     *root_y = XINT (top);
-  else if (*root_y + XINT (dy) - height < 0)
-    *root_y -= XINT (dy);
-  /* If there's not enough place below the pointer, put tip above it.  */
-  else if (*root_y + XINT (dy) >= FRAME_W32_DISPLAY_INFO (f)->height)
-    *root_y -= XINT (dy);
+  else if (*root_y + XINT (dy) + height <= FRAME_W32_DISPLAY_INFO (f)->height)
+    /* It fits below the pointer */
+      *root_y += XINT (dy);
+  else if (height + XINT (dy) <= *root_y)
+    /* It fits above the pointer.  */
+    *root_y -= height + XINT (dy);
   else
-    {
-      *root_y -= height;
-      *root_y += XINT (dy);
-    }
+    /* Put it on the top.  */
+    *root_y = 0;
 
   if (INTEGERP (left))
     *root_x = XINT (left);
--- a/src/xfns.c	Mon Dec 12 09:32:15 2005 +0000
+++ b/src/xfns.c	Mon Dec 12 09:32:59 2005 +0000
@@ -4940,16 +4940,15 @@
 
   if (INTEGERP (top))
     *root_y = XINT (top);
-  else if (*root_y + XINT (dy) - height < 0)
-    *root_y -= XINT (dy);
-  else if (*root_y + XINT (dy) >= FRAME_X_DISPLAY_INFO (f)->height)
-    /* Put tip above the pointer.  */
-    *root_y -= XINT (dy);
+  else if (*root_y + XINT (dy) + height <= FRAME_X_DISPLAY_INFO (f)->height)
+    /* It fits below the pointer */
+      *root_y += XINT (dy);
+  else if (height + XINT (dy) <= *root_y)
+    /* It fits above the pointer.  */
+    *root_y -= height + XINT (dy);
   else
-    {
-      *root_y -= height;
-      *root_y += XINT (dy);
-    }
+    /* Put it on the top.  */
+    *root_y = 0;
 
   if (INTEGERP (left))
     *root_x = XINT (left);