aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nsfns.m36
-rw-r--r--src/w32fns.c31
-rw-r--r--src/xfns.c31
3 files changed, 67 insertions, 31 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. */)
diff --git a/src/w32fns.c b/src/w32fns.c
index 6982eca84ac..8f9c56c5420 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5941,23 +5941,26 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5941 parameters for F. DX and DY are specified offsets from the current 5941 parameters for F. DX and DY are specified offsets from the current
5942 location of the mouse. WIDTH and HEIGHT are the width and height 5942 location of the mouse. WIDTH and HEIGHT are the width and height
5943 of the tooltip. Return coordinates relative to the root window of 5943 of the tooltip. Return coordinates relative to the root window of
5944 the display in *ROOT_X, and *ROOT_Y. */ 5944 the display in *ROOT_X and *ROOT_Y. */
5945 5945
5946static void 5946static void
5947compute_tip_xy (struct frame *f, 5947compute_tip_xy (struct frame *f,
5948 Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, 5948 Lisp_Object parms, Lisp_Object dx, Lisp_Object dy,
5949 int width, int height, int *root_x, int *root_y) 5949 int width, int height, int *root_x, int *root_y)
5950{ 5950{
5951 Lisp_Object left, top; 5951 Lisp_Object left, top, right, bottom;
5952 int min_x, min_y, max_x, max_y; 5952 int min_x, min_y, max_x, max_y;
5953 5953
5954 /* User-specified position? */ 5954 /* User-specified position? */
5955 left = Fcdr (Fassq (Qleft, parms)); 5955 left = Fcdr (Fassq (Qleft, parms));
5956 top = Fcdr (Fassq (Qtop, parms)); 5956 top = Fcdr (Fassq (Qtop, parms));
5957 right = Fcdr (Fassq (Qright, parms));
5958 bottom = Fcdr (Fassq (Qbottom, parms));
5957 5959
5958 /* Move the tooltip window where the mouse pointer is. Resize and 5960 /* Move the tooltip window where the mouse pointer is. Resize and
5959 show it. */ 5961 show it. */
5960 if (!INTEGERP (left) || !INTEGERP (top)) 5962 if ((!INTEGERP (left) && !INTEGERP (right))
5963 || (!INTEGERP (top) && !INTEGERP (bottom)))
5961 { 5964 {
5962 POINT pt; 5965 POINT pt;
5963 5966
@@ -5998,6 +6001,8 @@ compute_tip_xy (struct frame *f,
5998 6001
5999 if (INTEGERP (top)) 6002 if (INTEGERP (top))
6000 *root_y = XINT (top); 6003 *root_y = XINT (top);
6004 else if (INTEGERP (bottom))
6005 *root_y = XINT (bottom) - height;
6001 else if (*root_y + XINT (dy) <= min_y) 6006 else if (*root_y + XINT (dy) <= min_y)
6002 *root_y = min_y; /* Can happen for negative dy */ 6007 *root_y = min_y; /* Can happen for negative dy */
6003 else if (*root_y + XINT (dy) + height <= max_y) 6008 else if (*root_y + XINT (dy) + height <= max_y)
@@ -6012,6 +6017,8 @@ compute_tip_xy (struct frame *f,
6012 6017
6013 if (INTEGERP (left)) 6018 if (INTEGERP (left))
6014 *root_x = XINT (left); 6019 *root_x = XINT (left);
6020 else if (INTEGERP (right))
6021 *root_y = XINT (right) - width;
6015 else if (*root_x + XINT (dx) <= min_x) 6022 else if (*root_x + XINT (dx) <= min_x)
6016 *root_x = 0; /* Can happen for negative dx */ 6023 *root_x = 0; /* Can happen for negative dx */
6017 else if (*root_x + XINT (dx) + width <= max_x) 6024 else if (*root_x + XINT (dx) + width <= max_x)
@@ -6041,12 +6048,18 @@ Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
6041means use the default timeout of 5 seconds. 6048means use the default timeout of 5 seconds.
6042 6049
6043If the list of frame parameters PARMS contains a `left' parameter, 6050If the list of frame parameters PARMS contains a `left' parameter,
6044the tooltip is displayed at that x-position. Otherwise it is 6051display the tooltip at that x-position. If the list of frame parameters
6045displayed at the mouse position, with offset DX added (default is 5 if 6052PARMS contains no `left' but a `right' parameter, display the tooltip
6046DX isn't specified). Likewise for the y-position; if a `top' frame 6053right-adjusted at that x-position. Otherwise display it at the
6047parameter is specified, it determines the y-position of the tooltip 6054x-position of the mouse, with offset DX added (default is 5 if DX isn't
6048window, otherwise it is displayed at the mouse position, with offset 6055specified).
6049DY added (default is -10). 6056
6057Likewise for the y-position: If a `top' frame parameter is specified, it
6058determines the position of the upper edge of the tooltip window. If a
6059`bottom' parameter but no `top' frame parameter is specified, it
6060determines the position of the lower edge of the tooltip window.
6061Otherwise display the tooltip window at the y-position of the mouse,
6062with offset DY added (default is -10).
6050 6063
6051A tooltip's maximum size is specified by `x-max-tooltip-size'. 6064A tooltip's maximum size is specified by `x-max-tooltip-size'.
6052Text larger than the specified size is clipped. */) 6065Text larger than the specified size is clipped. */)
diff --git a/src/xfns.c b/src/xfns.c
index 88d187cdd62..fe3237f8500 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5344,7 +5344,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
5344static void 5344static void
5345compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, int width, int height, int *root_x, int *root_y) 5345compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object dy, int width, int height, int *root_x, int *root_y)
5346{ 5346{
5347 Lisp_Object left, top; 5347 Lisp_Object left, top, right, bottom;
5348 int win_x, win_y; 5348 int win_x, win_y;
5349 Window root, child; 5349 Window root, child;
5350 unsigned pmask; 5350 unsigned pmask;
@@ -5352,10 +5352,13 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object
5352 /* User-specified position? */ 5352 /* User-specified position? */
5353 left = Fcdr (Fassq (Qleft, parms)); 5353 left = Fcdr (Fassq (Qleft, parms));
5354 top = Fcdr (Fassq (Qtop, parms)); 5354 top = Fcdr (Fassq (Qtop, parms));
5355 right = Fcdr (Fassq (Qright, parms));
5356 bottom = Fcdr (Fassq (Qbottom, parms));
5355 5357
5356 /* Move the tooltip window where the mouse pointer is. Resize and 5358 /* Move the tooltip window where the mouse pointer is. Resize and
5357 show it. */ 5359 show it. */
5358 if (!INTEGERP (left) || !INTEGERP (top)) 5360 if ((!INTEGERP (left) && !INTEGERP (right))
5361 || (!INTEGERP (top) && !INTEGERP (bottom)))
5359 { 5362 {
5360 block_input (); 5363 block_input ();
5361 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window, 5364 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_DISPLAY_INFO (f)->root_window,
@@ -5365,6 +5368,8 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object
5365 5368
5366 if (INTEGERP (top)) 5369 if (INTEGERP (top))
5367 *root_y = XINT (top); 5370 *root_y = XINT (top);
5371 else if (INTEGERP (bottom))
5372 *root_y = XINT (bottom) - height;
5368 else if (*root_y + XINT (dy) <= 0) 5373 else if (*root_y + XINT (dy) <= 0)
5369 *root_y = 0; /* Can happen for negative dy */ 5374 *root_y = 0; /* Can happen for negative dy */
5370 else if (*root_y + XINT (dy) + height 5375 else if (*root_y + XINT (dy) + height
@@ -5380,6 +5385,8 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object
5380 5385
5381 if (INTEGERP (left)) 5386 if (INTEGERP (left))
5382 *root_x = XINT (left); 5387 *root_x = XINT (left);
5388 else if (INTEGERP (right))
5389 *root_y = XINT (right) - width;
5383 else if (*root_x + XINT (dx) <= 0) 5390 else if (*root_x + XINT (dx) <= 0)
5384 *root_x = 0; /* Can happen for negative dx */ 5391 *root_x = 0; /* Can happen for negative dx */
5385 else if (*root_x + XINT (dx) + width 5392 else if (*root_x + XINT (dx) + width
@@ -5409,13 +5416,19 @@ change the tooltip's appearance.
5409Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil 5416Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
5410means use the default timeout of 5 seconds. 5417means use the default timeout of 5 seconds.
5411 5418
5412If the list of frame parameters PARMS contains a `left' parameters, 5419If the list of frame parameters PARMS contains a `left' parameter,
5413the tooltip is displayed at that x-position. Otherwise it is 5420display the tooltip at that x-position. If the list of frame parameters
5414displayed at the mouse position, with offset DX added (default is 5 if 5421PARMS contains no `left' but a `right' parameter, display the tooltip
5415DX isn't specified). Likewise for the y-position; if a `top' frame 5422right-adjusted at that x-position. Otherwise display it at the
5416parameter is specified, it determines the y-position of the tooltip 5423x-position of the mouse, with offset DX added (default is 5 if DX isn't
5417window, otherwise it is displayed at the mouse position, with offset 5424specified).
5418DY added (default is -10). 5425
5426Likewise for the y-position: If a `top' frame parameter is specified, it
5427determines the position of the upper edge of the tooltip window. If a
5428`bottom' parameter but no `top' frame parameter is specified, it
5429determines the position of the lower edge of the tooltip window.
5430Otherwise display the tooltip window at the y-position of the mouse,
5431with offset DY added (default is -10).
5419 5432
5420A tooltip's maximum size is specified by `x-max-tooltip-size'. 5433A tooltip's maximum size is specified by `x-max-tooltip-size'.
5421Text larger than the specified size is clipped. */) 5434Text larger than the specified size is clipped. */)