1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-20 18:17:20 +00:00

; Minor improvements to earlier change

* etc/NEWS:
* lisp/tooltip.el (tooltip-show): Rename `frame-face' to
`default-face' and improve doc about system tooltips.
This commit is contained in:
Po Lu 2022-05-13 20:48:46 +08:00
parent 39e9665127
commit 784a3bde24
2 changed files with 17 additions and 15 deletions

View File

@ -2031,7 +2031,7 @@ Use 'buffer-match-p' to gather a list of buffers that match a
condition.
---
** New arguments 'text-face' and 'frame-face' for 'tooltip-show'.
** New arguments 'text-face' and 'default-face' for 'tooltip-show'.
They allow changing the faces used for the tooltip text and frame
colors of the resulting tooltip frame from the default 'tooltip' face.

View File

@ -230,16 +230,16 @@ change the existing association. Value is the resulting alist."
(declare-function x-show-tip "xfns.c"
(string &optional frame parms timeout dx dy))
(defun tooltip-show (text &optional use-echo-area text-face frame-face)
(defun tooltip-show (text &optional use-echo-area text-face default-face)
"Show a tooltip window displaying TEXT.
Text larger than `x-max-tooltip-size' is clipped.
If the alist in `tooltip-frame-parameters' includes `left' and `top'
parameters, they determine the x and y position where the tooltip
is displayed. Otherwise, the tooltip pops at offsets specified by
`tooltip-x-offset' and `tooltip-y-offset' from the current mouse
position.
If the alist in `tooltip-frame-parameters' includes `left' and
`top' parameters, they determine the x and y position where the
tooltip is displayed. Otherwise, the tooltip pops at offsets
specified by `tooltip-x-offset' and `tooltip-y-offset' from the
current mouse position.
The text properties of TEXT are also modified to add the
appropriate faces before displaying the tooltip. If your code
@ -249,21 +249,23 @@ passing it to this function.
Optional second arg USE-ECHO-AREA non-nil means to show tooltip
in echo area.
The third and fourth args TEXT-FACE and FRAME-FACE specify faces
used to display the tooltip, and default to `tooltip' if not
specified. TEXT-FACE specifies a face used to display text in
the tooltip, while FRAME-FACE specifies a face that provides the
background, foreground and border colors of the tooltip frame.
The third and fourth args TEXT-FACE and DEFAULT-FACE specify
faces used to display the tooltip, and default to `tooltip' if
not specified. TEXT-FACE specifies a face used to display text
in the tooltip, while DEFAULT-FACE specifies a face that provides
the background, foreground and border colors of the tooltip
frame.
Note that the last two arguments are not respected when
`use-system-tooltips' is non-nil and Emacs is built with support
for system tooltips."
for system tooltips, such as on NS, Haiku, and with the GTK
toolkit."
(if use-echo-area
(tooltip-show-help-non-mode text)
(condition-case error
(let ((params (copy-sequence tooltip-frame-parameters))
(fg (face-attribute (or frame-face 'tooltip) :foreground))
(bg (face-attribute (or frame-face 'tooltip) :background)))
(fg (face-attribute (or default-face 'tooltip) :foreground))
(bg (face-attribute (or default-face 'tooltip) :background)))
(when (stringp fg)
(setf (alist-get 'foreground-color params) fg)
(setf (alist-get 'border-color params) fg))