]> code.delx.au - gnu-emacs/commitdiff
(compute_tip_xy): If tooltip won't fit on the screen
authorRichard M. Stallman <rms@gnu.org>
Fri, 21 Dec 2001 22:55:36 +0000 (22:55 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 21 Dec 2001 22:55:36 +0000 (22:55 +0000)
to the left or to the right of the pointer, put it against
the left screen edge.

src/xfns.c

index e310c31885037a8a69b3e3ba15929060baa6ba1f..c8bce15fbd642ae597ba9ce16a26f324307dd723 100644 (file)
@@ -11126,10 +11126,15 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
 
   if (INTEGERP (left))
     *root_x = XINT (left);
-  else if (*root_x + XINT (dx) + width > FRAME_X_DISPLAY_INFO (f)->width)
+  else if (*root_x + XINT (dx) + width <= FRAME_X_DISPLAY_INFO (f)->width)
+    /* It fits to the right of the pointer.  */
+    *root_x += XINT (dx);
+  else if (width + XINT (dx) <= *root_x)
+    /* It fits to the left of the pointer.  */
     *root_x -= width + XINT (dx);
   else
-    *root_x += XINT (dx);
+    /* Put it left-justified on the screen--it ought to fit that way.  */
+    *root_x = 0;
 }