]> code.delx.au - gnu-emacs/commitdiff
* (compute_tip_xy): Calculate root_y the same way as root_x,
authorJan Djärv <jan.h.d@swipnet.se>
Mon, 12 Dec 2005 09:32:59 +0000 (09:32 +0000)
committerJan Djärv <jan.h.d@swipnet.se>
Mon, 12 Dec 2005 09:32:59 +0000 (09:32 +0000)
i.e. dy is offset from top of frame instead of bottom.

src/macfns.c
src/w32fns.c
src/xfns.c

index 9d23f47b5ed1df72412af6bf9253b1d9c6485e23..de6a055fce62171408cd32eb20f9f5f85d77c2e8 100644 (file)
@@ -3840,13 +3840,15 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
 
   if (INTEGERP (top))
     *root_y = XINT (top);
-  else if (*root_y + XINT (dy) - height < 0)
-    *root_y -= XINT (dy);
-  else
-    {
-      *root_y -= height;
+  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
+    /* Put it on the top.  */
+    *root_y = 0;
 
   if (INTEGERP (left))
     *root_x = XINT (left);
index d1e4e49bb0309f2472e327ceba0c3991c6cb5534..647267972dc27d931d0b2cfd67cfa552ff6106f0 100644 (file)
@@ -7411,16 +7411,15 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
 
   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
-    {
-      *root_y -= height;
+  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
+    /* Put it on the top.  */
+    *root_y = 0;
 
   if (INTEGERP (left))
     *root_x = XINT (left);
index ee4a7bf3b004d1eb0dbc42d2e43ef26f1c421841..667b1411d1c70f61785606fa479a1eeb68f491d6 100644 (file)
@@ -4940,16 +4940,15 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
 
   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
-    {
-      *root_y -= height;
+  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
+    /* Put it on the top.  */
+    *root_y = 0;
 
   if (INTEGERP (left))
     *root_x = XINT (left);