1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

Rename system tooltip variables to `use-system-tooltips'

* doc/emacs/frames.texi (Tooltips):
* doc/emacs/haiku.texi (Haiku Basics):
* doc/lispref/display.texi (Tooltips): Document
`use-system-tooltips' instead.

* etc/NEWS: Announce new option.
* lisp/cus-start.el (standard): Add new option.

* lisp/term/haiku-win.el (haiku-use-system-tooltips):
* lisp/term/pgtk-win.el (x-gtk-use-system-tooltips):
* lisp/term/x-win.el (x-gtk-use-system-tooltips): Add aliases
for old options.

* src/frame.c (syms_of_frame): New variable
`use-system-tooltips'.

* src/haikufns.c (Fx_show_tip):
(syms_of_haikufns):
* src/pgtkfns.c (x_hide_tip):
(Fx_show_tip):
(syms_of_pgtkfns):
* src/xfns.c (x_hide_tip):
(Fx_show_tip):
(syms_of_xfns): Use `use-system-tooltips' instead of the old
platform dependent options.
This commit is contained in:
Po Lu 2022-01-19 13:12:18 +08:00
parent 90dda33108
commit 95084cec09
12 changed files with 55 additions and 53 deletions

View file

@ -1633,13 +1633,14 @@ Parameters,,, elisp, The Emacs Lisp Reference Manual}, and also
For additional customization options for displaying tooltips, use For additional customization options for displaying tooltips, use
@kbd{M-x customize-group @key{RET} tooltip @key{RET}}. @kbd{M-x customize-group @key{RET} tooltip @key{RET}}.
@vindex x-gtk-use-system-tooltips @vindex use-system-tooltips
If Emacs is built with GTK+ support, it displays tooltips via GTK+, If Emacs is built with the GTK+ toolkit or Haiku windowing support,
using the default appearance of GTK+ tooltips. To disable this, it displays tooltips via the toolkit, using the default appearance of
change the variable @code{x-gtk-use-system-tooltips} to @code{nil}. the toolkit's tooltips. To disable this, change the variable
If you do this, or if Emacs is built without GTK+ support, most @code{use-system-tooltips} to @code{nil}. If you do this, or if Emacs
attributes of the tooltip text are specified by the @code{tooltip} is built without GTK+ or Haiku windowing support, most attributes of
face, and by X resources (@pxref{X Resources}). the tooltip text are specified by the @code{tooltip} face, and by X
resources (@pxref{X Resources}).
@dfn{GUD tooltips} are special tooltips that show the values of @dfn{GUD tooltips} are special tooltips that show the values of
variables when debugging a program with GUD@. @xref{Debugger variables when debugging a program with GUD@. @xref{Debugger

View file

@ -85,15 +85,15 @@ instead.
@cindex tooltips (haiku) @cindex tooltips (haiku)
@cindex haiku tooltips @cindex haiku tooltips
@vindex haiku-use-system-tooltips
On Haiku, Emacs defaults to using the system tooltip mechanism. On Haiku, Emacs defaults to using the system tooltip mechanism.
This usually leads to more responsive tooltips, but the tooltips will This usually leads to more responsive tooltips, but the tooltips will
not be able to display text properties or faces. If you need those not be able to display text properties or faces. If you need those
features, customize the variable @code{haiku-use-system-tooltips} to features, customize the variable @code{use-system-tooltips} to the
the nil value, and Emacs will use its own implementation of tooltips. @code{nil} value, and Emacs will use its own implementation of
tooltips.
System tooltips cannot display above the menu bar, so help text System tooltips cannot display above the menu bar, so help text in
in the menu bar will display in the echo area instead when they are the menu bar will display in the echo area instead when they are
enabled. enabled.
@cindex X resources on Haiku @cindex X resources on Haiku

View file

@ -8438,13 +8438,14 @@ displayed in the echo area.
@end defun @end defun
@cindex system tooltips @cindex system tooltips
@vindex x-gtk-use-system-tooltips @vindex use-system-tooltips
When Emacs is built with GTK+ support, it by default displays tooltips When Emacs is built with the GTK+ toolkit or Haiku windowing support,
using GTK+ functions, and the appearance of the tooltips is then it by default displays tooltips using toolkit functions, and the
controlled by GTK+ settings. GTK+ tooltips can be disabled by appearance of the tooltips is then controlled by by the toolkit's
changing the value of the variable @code{x-gtk-use-system-tooltips} to settings. Toolkit-provided tooltips can be disabled by changing the
@code{nil}. The rest of this subsection describes how to control value of the variable @code{use-system-tooltips} to @code{nil}. The
non-GTK+ tooltips, which are presented by Emacs itself. rest of this subsection describes how to control non-toolkit tooltips,
which are presented by Emacs itself.
@cindex tooltip frames @cindex tooltip frames
Tooltips are displayed in special frames called tooltip frames, which Tooltips are displayed in special frames called tooltip frames, which

View file

@ -154,6 +154,11 @@ methods.
This controls whether or not GTK input methods are used by Emacs, This controls whether or not GTK input methods are used by Emacs,
instead of XIM input methods. instead of XIM input methods.
+++
** New user option 'use-system-tooltips'.
This controls whether or not to use the toolkit Emacs was built with
to display tooltips, if supported.
--- ---
** New minor mode 'pixel-scroll-precision-mode'. ** New minor mode 'pixel-scroll-precision-mode'.
When enabled, and if your mouse supports it, you can scroll the When enabled, and if your mouse supports it, you can scroll the

View file

@ -356,6 +356,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
(const :tag "Iconify" t)) (const :tag "Iconify" t))
"26.1") "26.1")
(tooltip-reuse-hidden-frame tooltip boolean "26.1") (tooltip-reuse-hidden-frame tooltip boolean "26.1")
(use-system-tooltips tooltip boolean "29.1")
;; fringe.c ;; fringe.c
(overflow-newline-into-fringe fringe boolean) (overflow-newline-into-fringe fringe boolean)
;; image.c ;; image.c

View file

@ -136,6 +136,8 @@ If TYPE is nil, return \"text/plain\"."
(define-key special-event-map [drag-n-drop] (define-key special-event-map [drag-n-drop]
'haiku-dnd-handle-drag-n-drop-event) 'haiku-dnd-handle-drag-n-drop-event)
(defvaralias 'haiku-use-system-tooltips 'use-system-tooltips)
(provide 'haiku-win) (provide 'haiku-win)
(provide 'term/haiku-win) (provide 'term/haiku-win)

View file

@ -510,6 +510,8 @@ This uses `icon-map-list' to map icon file names to stock icon names."
(t (t
(popup-menu (mouse-menu-bar-map) last-nonmenu-event)))) (popup-menu (mouse-menu-bar-map) last-nonmenu-event))))
(defvaralias 'x-gtk-use-system-tooltips 'use-system-tooltips)
(provide 'pgtk-win) (provide 'pgtk-win)
(provide 'term/pgtk-win) (provide 'term/pgtk-win)

View file

@ -1561,6 +1561,8 @@ EVENT is a preedit-text event."
(define-key special-event-map [preedit-text] 'x-preedit-text) (define-key special-event-map [preedit-text] 'x-preedit-text)
(defvaralias 'x-gtk-use-system-tooltips 'use-system-tooltips)
(provide 'x-win) (provide 'x-win)
(provide 'term/x-win) (provide 'term/x-win)

View file

@ -6472,6 +6472,14 @@ This variable is effective only with the X toolkit (and there only when
Gtk+ tooltips are not used) and on Windows. */); Gtk+ tooltips are not used) and on Windows. */);
tooltip_reuse_hidden_frame = false; tooltip_reuse_hidden_frame = false;
DEFVAR_BOOL ("use-system-tooltips", use_system_tooltips,
doc: /* Use the toolkit to display tooltips.
This option is only meaningful when Emacs is built with GTK+ or Haiku
windowing support, and results in tooltips that look like those
displayed by other GTK+ or Haiku programs, but will not be able to
display text properties inside tooltip text. */);
use_system_tooltips = true;
DEFVAR_LISP ("iconify-child-frame", iconify_child_frame, DEFVAR_LISP ("iconify-child-frame", iconify_child_frame,
doc: /* How to handle iconification of child frames. doc: /* How to handle iconification of child frames.
This variable tells Emacs how to proceed when it is asked to iconify a This variable tells Emacs how to proceed when it is asked to iconify a

View file

@ -1946,7 +1946,7 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
else else
CHECK_FIXNUM (dy); CHECK_FIXNUM (dy);
if (haiku_use_system_tooltips) if (use_system_tooltips)
{ {
int root_x, root_y; int root_x, root_y;
CHECK_STRING (string); CHECK_STRING (string);
@ -2672,14 +2672,6 @@ syms_of_haikufns (void)
doc: /* SKIP: real doc in xfns.c. */); doc: /* SKIP: real doc in xfns.c. */);
Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40)); Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40));
DEFVAR_BOOL ("haiku-use-system-tooltips", haiku_use_system_tooltips,
doc: /* When non-nil, Emacs will display tooltips using the App Kit.
This can avoid a great deal of consing that does not play
well with the Haiku memory allocator, but comes with the
disadvantage of not being able to use special display properties
within tooltips. */);
haiku_use_system_tooltips = 1;
#ifdef USE_BE_CAIRO #ifdef USE_BE_CAIRO
DEFVAR_LISP ("cairo-version-string", Vcairo_version_string, DEFVAR_LISP ("cairo-version-string", Vcairo_version_string,
doc: /* Version info for cairo. */); doc: /* Version info for cairo. */);

View file

@ -3128,7 +3128,7 @@ x_hide_tip (bool delete)
value of x_gtk_use_system_tooltips might not be the same as used value of x_gtk_use_system_tooltips might not be the same as used
for the tooltip we have to hide, see Bug#30399. */ for the tooltip we have to hide, see Bug#30399. */
if ((NILP (tip_last_frame) && NILP (tip_frame)) if ((NILP (tip_last_frame) && NILP (tip_frame))
|| (!x_gtk_use_system_tooltips || (!use_system_tooltips
&& !delete && !delete
&& FRAMEP (tip_frame) && FRAMEP (tip_frame)
&& FRAME_LIVE_P (XFRAME (tip_frame)) && FRAME_LIVE_P (XFRAME (tip_frame))
@ -3161,7 +3161,7 @@ x_hide_tip (bool delete)
/* When using GTK+ system tooltips (compare Bug#41200) reset /* When using GTK+ system tooltips (compare Bug#41200) reset
tip_last_frame. It will be reassigned when showing the next tip_last_frame. It will be reassigned when showing the next
GTK+ system tooltip. */ GTK+ system tooltip. */
if (x_gtk_use_system_tooltips) if (use_system_tooltips)
tip_last_frame = Qnil; tip_last_frame = Qnil;
/* Now look whether there's an Emacs tip around. */ /* Now look whether there's an Emacs tip around. */
@ -3171,7 +3171,7 @@ x_hide_tip (bool delete)
if (FRAME_LIVE_P (f)) if (FRAME_LIVE_P (f))
{ {
if (delete || x_gtk_use_system_tooltips) if (delete || use_system_tooltips)
{ {
/* Delete the Emacs tooltip frame when DELETE is true /* Delete the Emacs tooltip frame when DELETE is true
or we change the tooltip type from an Emacs one to or we change the tooltip type from an Emacs one to
@ -3267,7 +3267,7 @@ Text larger than the specified size is clipped. */)
else else
CHECK_FIXNUM (dy); CHECK_FIXNUM (dy);
if (x_gtk_use_system_tooltips) if (use_system_tooltips)
{ {
bool ok; bool ok;
@ -4068,12 +4068,6 @@ If more space for files in the file chooser dialog is wanted, set this to nil
to turn the additional text off. */); to turn the additional text off. */);
x_gtk_file_dialog_help_text = true; x_gtk_file_dialog_help_text = true;
DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips,
doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used.
Otherwise use Emacs own tooltip implementation.
When using Gtk+ tooltips, the tooltip face is not used. */);
x_gtk_use_system_tooltips = true;
DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size, DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
doc: /* Maximum size for tooltips. doc: /* Maximum size for tooltips.
Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */);

View file

@ -7357,13 +7357,13 @@ x_hide_tip (bool delete)
} }
#ifdef USE_GTK #ifdef USE_GTK
/* Any GTK+ system tooltip can be found via the x_output structure of /* Any GTK+ system tooltip can be found via the x_output structure
tip_last_frame, provided that frame is still live. Any Emacs of tip_last_frame, provided that frame is still live. Any Emacs
tooltip is found via the tip_frame variable. Note that the current tooltip is found via the tip_frame variable. Note that the
value of x_gtk_use_system_tooltips might not be the same as used current value of use_system_tooltips might not be the same as
for the tooltip we have to hide, see Bug#30399. */ used for the tooltip we have to hide, see Bug#30399. */
if ((NILP (tip_last_frame) && NILP (tip_frame)) if ((NILP (tip_last_frame) && NILP (tip_frame))
|| (!x_gtk_use_system_tooltips || (!use_system_tooltips
&& !delete && !delete
&& !NILP (tip_frame) && !NILP (tip_frame)
&& FRAME_LIVE_P (XFRAME (tip_frame)) && FRAME_LIVE_P (XFRAME (tip_frame))
@ -7396,7 +7396,7 @@ x_hide_tip (bool delete)
/* When using GTK+ system tooltips (compare Bug#41200) reset /* When using GTK+ system tooltips (compare Bug#41200) reset
tip_last_frame. It will be reassigned when showing the next tip_last_frame. It will be reassigned when showing the next
GTK+ system tooltip. */ GTK+ system tooltip. */
if (x_gtk_use_system_tooltips) if (use_system_tooltips)
tip_last_frame = Qnil; tip_last_frame = Qnil;
/* Now look whether there's an Emacs tip around. */ /* Now look whether there's an Emacs tip around. */
@ -7406,7 +7406,7 @@ x_hide_tip (bool delete)
if (FRAME_LIVE_P (f)) if (FRAME_LIVE_P (f))
{ {
if (delete || x_gtk_use_system_tooltips) if (delete || use_system_tooltips)
{ {
/* Delete the Emacs tooltip frame when DELETE is true /* Delete the Emacs tooltip frame when DELETE is true
or we change the tooltip type from an Emacs one to or we change the tooltip type from an Emacs one to
@ -7565,7 +7565,7 @@ Text larger than the specified size is clipped. */)
CHECK_FIXNUM (dy); CHECK_FIXNUM (dy);
#ifdef USE_GTK #ifdef USE_GTK
if (x_gtk_use_system_tooltips) if (use_system_tooltips)
{ {
bool ok; bool ok;
@ -8647,12 +8647,6 @@ If more space for files in the file chooser dialog is wanted, set this to nil
to turn the additional text off. */); to turn the additional text off. */);
x_gtk_file_dialog_help_text = true; x_gtk_file_dialog_help_text = true;
DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips,
doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used.
Otherwise use Emacs own tooltip implementation.
When using Gtk+ tooltips, the tooltip face is not used. */);
x_gtk_use_system_tooltips = true;
DEFVAR_LISP ("x-gtk-resize-child-frames", x_gtk_resize_child_frames, DEFVAR_LISP ("x-gtk-resize-child-frames", x_gtk_resize_child_frames,
doc: /* If non-nil, resize child frames specially with GTK builds. doc: /* If non-nil, resize child frames specially with GTK builds.
If this is nil, resize child frames like any other frames. This is the If this is nil, resize child frames like any other frames. This is the