# HG changeset patch # User Jan Dj¸«£rv # Date 1134379979 0 # Node ID 5b6c71adc503cd0a3a023efefd487f0f0295fd6d # Parent dcb511f8ef758d7c28af50c792c45771e62ff3f7 * (compute_tip_xy): Calculate root_y the same way as root_x, i.e. dy is offset from top of frame instead of bottom. diff -r dcb511f8ef75 -r 5b6c71adc503 src/macfns.c --- 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); diff -r dcb511f8ef75 -r 5b6c71adc503 src/w32fns.c --- 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); diff -r dcb511f8ef75 -r 5b6c71adc503 src/xfns.c --- 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);