aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfns.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index c6de744c750..a165304741c 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2673,7 +2673,7 @@ compute_tip_xy (struct frame *f,
2673 int *root_x, 2673 int *root_x,
2674 int *root_y) 2674 int *root_y)
2675{ 2675{
2676 Lisp_Object left, top; 2676 Lisp_Object left, top, right, bottom;
2677 EmacsView *view = FRAME_NS_VIEW (f); 2677 EmacsView *view = FRAME_NS_VIEW (f);
2678 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 2678 struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
2679 NSPoint pt; 2679 NSPoint pt;
@@ -2681,8 +2681,11 @@ compute_tip_xy (struct frame *f,
2681 /* Start with user-specified or mouse position. */ 2681 /* Start with user-specified or mouse position. */
2682 left = Fcdr (Fassq (Qleft, parms)); 2682 left = Fcdr (Fassq (Qleft, parms));
2683 top = Fcdr (Fassq (Qtop, parms)); 2683 top = Fcdr (Fassq (Qtop, parms));
2684 right = Fcdr (Fassq (Qright, parms));
2685 bottom = Fcdr (Fassq (Qbottom, parms));
2684 2686
2685 if (!INTEGERP (left) || !INTEGERP (top)) 2687 if ((!INTEGERP (left) && !INTEGERP (right))
2688 || (!INTEGERP (top) && !INTEGERP (bottom)))
2686 { 2689 {
2687 pt.x = dpyinfo->last_mouse_motion_x; 2690 pt.x = dpyinfo->last_mouse_motion_x;
2688 pt.y = dpyinfo->last_mouse_motion_y; 2691 pt.y = dpyinfo->last_mouse_motion_y;
@@ -2702,13 +2705,14 @@ compute_tip_xy (struct frame *f,
2702 else 2705 else
2703 { 2706 {
2704 /* Absolute coordinates. */ 2707 /* Absolute coordinates. */
2705 pt.x = XINT (left); 2708 pt.x = INTEGERP (left) ? XINT (left) : XINT (right);
2706 pt.y = x_display_pixel_height (FRAME_DISPLAY_INFO (f)) - XINT (top) 2709 pt.y = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
2707 - height; 2710 - (INTEGERP (top) ? XINT (top) : XINT (bottom))
2711 - height);
2708 } 2712 }
2709 2713
2710 /* Ensure in bounds. (Note, screen origin = lower left.) */ 2714 /* Ensure in bounds. (Note, screen origin = lower left.) */
2711 if (INTEGERP (left)) 2715 if (INTEGERP (left) || INTEGERP (right))
2712 *root_x = pt.x; 2716 *root_x = pt.x;
2713 else if (pt.x + XINT (dx) <= 0) 2717 else if (pt.x + XINT (dx) <= 0)
2714 *root_x = 0; /* Can happen for negative dx */ 2718 *root_x = 0; /* Can happen for negative dx */
@@ -2723,7 +2727,7 @@ compute_tip_xy (struct frame *f,
2723 /* Put it left justified on the screen -- it ought to fit that way. */ 2727 /* Put it left justified on the screen -- it ought to fit that way. */
2724 *root_x = 0; 2728 *root_x = 0;
2725 2729
2726 if (INTEGERP (top)) 2730 if (INTEGERP (top) || INTEGERP (bottom))
2727 *root_y = pt.y; 2731 *root_y = pt.y;
2728 else if (pt.y - XINT (dy) - height >= 0) 2732 else if (pt.y - XINT (dy) - height >= 0)
2729 /* It fits below the pointer. */ 2733 /* It fits below the pointer. */
@@ -2753,12 +2757,18 @@ Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
2753means use the default timeout of 5 seconds. 2757means use the default timeout of 5 seconds.
2754 2758
2755If the list of frame parameters PARMS contains a `left' parameter, 2759If the list of frame parameters PARMS contains a `left' parameter,
2756the tooltip is displayed at that x-position. Otherwise it is 2760display the tooltip at that x-position. If the list of frame parameters
2757displayed at the mouse position, with offset DX added (default is 5 if 2761PARMS contains no `left' but a `right' parameter, display the tooltip
2758DX isn't specified). Likewise for the y-position; if a `top' frame 2762right-adjusted at that x-position. Otherwise display it at the
2759parameter is specified, it determines the y-position of the tooltip 2763x-position of the mouse, with offset DX added (default is 5 if DX isn't
2760window, otherwise it is displayed at the mouse position, with offset 2764specified).
2761DY added (default is -10). 2765
2766Likewise for the y-position: If a `top' frame parameter is specified, it
2767determines the position of the upper edge of the tooltip window. If a
2768`bottom' parameter but no `top' frame parameter is specified, it
2769determines the position of the lower edge of the tooltip window.
2770Otherwise display the tooltip window at the y-position of the mouse,
2771with offset DY added (default is -10).
2762 2772
2763A tooltip's maximum size is specified by `x-max-tooltip-size'. 2773A tooltip's maximum size is specified by `x-max-tooltip-size'.
2764Text larger than the specified size is clipped. */) 2774Text larger than the specified size is clipped. */)