}
-DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 4, 0,
+DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
"Show STRING in a \"tooltip\" window on frame FRAME.\n\
-A tooltip window is a small X window displaying STRING at\n\
-the current mouse position.\n\
+A tooltip window is a small X window displaying a string.\n\
+\n\
FRAME nil or omitted means use the selected frame.\n\
+\n\
PARMS is an optional list of frame parameters which can be\n\
used to change the tooltip's appearance.\n\
+\n\
Automatically hide the tooltip after TIMEOUT seconds.\n\
-TIMEOUT nil means use the default timeout of 5 seconds.")
- (string, frame, parms, timeout)
- Lisp_Object string, frame, parms, timeout;
+TIMEOUT nil means use the default timeout of 5 seconds.\n\
+\n\
+If the list of frame parameters PARAMS contains a `left' parameters,\n\
+the tooltip is displayed at that x-position. Otherwise it is\n\
+displayed at the mouse position, with offset DX added (default is 5 if\n\
+DX isn't specified). Likewise for the y-position; if a `top' frame\n\
+parameter is specified, it determines the y-position of the tooltip\n\
+window, otherwise it is displayed at the mouse position, with offset\n\
+DY added (default is -5).")
+ (string, frame, parms, timeout, dx, dy)
+ Lisp_Object string, frame, parms, timeout, dx, dy;
{
struct frame *f;
struct window *w;
Window root, child;
- Lisp_Object buffer;
+ Lisp_Object buffer, top, left;
struct buffer *old_buffer;
struct text_pos pos;
int i, width, height;
timeout = make_number (5);
else
CHECK_NATNUM (timeout, 2);
+
+ if (NILP (dx))
+ dx = make_number (5);
+ else
+ CHECK_NUMBER (dx, 5);
+
+ if (NILP (dy))
+ dy = make_number (-5);
+ else
+ CHECK_NUMBER (dy, 6);
/* Hide a previous tip, if any. */
Fx_hide_tip ();
height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
+ /* User-specified position? */
+ left = Fcdr (Fassq (Qleft, parms));
+ top = Fcdr (Fassq (Qtop, parms));
+
/* Move the tooltip window where the mouse pointer is. Resize and
show it. */
BLOCK_INPUT;
XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
&root, &child, &root_x, &root_y, &win_x, &win_y, &pmask);
+ UNBLOCK_INPUT;
+
+ root_x += XINT (dx);
+ root_y += XINT (dy);
+
+ if (INTEGERP (left))
+ root_x = XINT (left);
+ if (INTEGERP (top))
+ root_y = XINT (top);
+
+ BLOCK_INPUT;
XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- root_x + 5, root_y - height - 5, width, height);
+ root_x, root_y - height, width, height);
XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
UNBLOCK_INPUT;