diff src/xfns.c @ 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 28a148064aa7
children 05d48e1da3ad
line wrap: on
line diff
--- 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);