From: martin rudalics <rudalics@gmx.at>
To: Stephen Berman <stephen.berman@gmx.net>, 30399@debbugs.gnu.org
Subject: bug#30399: 27.0.50; tooltips are broken
Date: Fri, 09 Feb 2018 10:53:30 +0100 [thread overview]
Message-ID: <5A7D6F9A.1010504@gmx.at> (raw)
In-Reply-To: <87wozn9kyy.fsf@gmx.net>
[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]
> And here's the buggy behavior (starting with step 2) I see on master
> since the above commit:
>
> 0. emacs -Q
> 1. evaluate (tooltip-show "This is a test")
> => A GTK+-themed tooltip is displayed for 10 seconds or until there
> is an input event, then disappears.
> 2. evaluate (x-show-tip "This is a test")
> => A GTK+-themed tooltip is displayed and remains displayed, even if
> there are input events, until executing step 3 or repeating step 1.
This is due to a rather silly omission which should have already
defeated a feature in Emacs 26 when calling 'x-show-tip' (you've been
warned - Lisp code should call 'tooltip-show').
> 3. evaluate (let (x-gtk-use-system-tooltips)
> (tooltip-show "This is a test"))
> => A non-toolkit tooltip is displayed and remains displayed, even if
> there are input events, until the end of the Emacs session (at least
> I haven't found a way to get rid of it); however, if the GTK+-themed
> tooltip from step 2 is still displayed when the above sexp is
> evaluated, then after 10 (not 5) seconds the GTK+-themed tooltip
> disappears (but the non-toolkit tooltip remains).
> 4. evaluate (let (x-gtk-use-system-tooltips)
> (x-show-tip "This is a test"))
> => A non-toolkit tooltip is displayed and remains displayed, even if
> there are input events, until the end of the Emacs session AFAICT; if
> the tooltip from step 3 is still displayed when the above sexp is
> evaluated, it is just moved by this step but does not disappear, and
> if the GTK+-themed tooltip from step 2 is still displayed that
> tooltip also remains displayed (unlike in step 3).
Let-binding 'x-gtk-use-system-tooltips' is a more delicate issue. As
a rule, options should never be let-bound but since the customizer is
always right we'll probably have to fix this as well.
Please try the attached fix. And please test it also with the inverse
scenario
(setq x-gtk-use-system-tooltips nil)
(let ((x-gtk-use-system-tooltips t))
(tooltip-show "Test"))
Thanks, martin
[-- Attachment #2: gtk-tooltip.diff --]
[-- Type: text/plain, Size: 3955 bytes --]
diff --git a/src/xfns.c b/src/xfns.c
index db1ce31..9f0d946 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -6077,7 +6077,7 @@ static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
/* STRING argument of last `x-show-tip' call. */
static Lisp_Object tip_last_string;
-/* FRAME argument of last `x-show-tip' call. */
+/* Normalized FRAME argument of last `x-show-tip' call. */
static Lisp_Object tip_last_frame;
/* PARMS argument of last `x-show-tip' call. */
@@ -6542,16 +6542,20 @@ static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
}
#ifdef USE_GTK
- /* The GTK+ system tooltip window can be found via the x_output
- structure of tip_last_frame, if it still exists. */
- if (x_gtk_use_system_tooltips && NILP (tip_last_frame))
- return Qnil;
- else if (!x_gtk_use_system_tooltips
- && (NILP (tip_frame)
- || (!delete
- && FRAMEP (tip_frame)
- && FRAME_LIVE_P (XFRAME (tip_frame))
- && !FRAME_VISIBLE_P (XFRAME (tip_frame)))))
+ /* Any GTK+ system tooltip can be found via the x_output structure of
+ tip_last_frame, provided that frame is still live. Any Emacs
+ tooltip is found via the tip_frame variable. Note that the current
+ value of x_gtk_use_system_tooltips might not be the same as used
+ for the tooltip we have to hide, see Bug#30399. */
+ if ((NILP (tip_last_frame) && NILP (tip_frame))
+ || (!x_gtk_use_system_tooltips
+ && !delete
+ && FRAMEP (tip_frame)
+ && FRAME_LIVE_P (XFRAME (tip_frame))
+ && !FRAME_VISIBLE_P (XFRAME (tip_frame))))
+ /* Either there's no tooltip to hide or it's an already invisible
+ Emacs tooltip and we don't want to change its type. Return
+ quickly. */
return Qnil;
else
{
@@ -6562,10 +6566,9 @@ static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
specbind (Qinhibit_redisplay, Qt);
specbind (Qinhibit_quit, Qt);
- if (x_gtk_use_system_tooltips)
+ /* Try to hide the GTK+ system tip first. */
+ if (FRAMEP (tip_last_frame))
{
- /* The GTK+ system tooltip window is stored in the x_output
- structure of tip_last_frame. */
struct frame *f = XFRAME (tip_last_frame);
if (FRAME_LIVE_P (f))
@@ -6573,33 +6576,37 @@ static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
if (xg_hide_tooltip (f))
was_open = Qt;
}
- else
- tip_last_frame = Qnil;
}
- else
+
+ /* Reset tip_last_frame, it will be reassigned when showing the
+ next GTK+ system tooltip. */
+ tip_last_frame = Qnil;
+
+ /* Now look whether there's an Emacs tip around. */
+ if (FRAMEP (tip_frame))
{
- if (FRAMEP (tip_frame))
- {
- struct frame *f = XFRAME (tip_frame);
+ struct frame *f = XFRAME (tip_frame);
- if (FRAME_LIVE_P (f))
+ if (FRAME_LIVE_P (f))
+ {
+ if (delete || x_gtk_use_system_tooltips)
{
- if (delete)
- {
- delete_frame (tip_frame, Qnil);
- tip_frame = Qnil;
- }
- else
- x_make_frame_invisible (f);
-
- was_open = Qt;
+ /* Delete the Emacs tooltip frame when DELETE is true
+ or we change the tooltip type from an Emacs one to
+ a GTK+ system one. */
+ delete_frame (tip_frame, Qnil);
+ tip_frame = Qnil;
}
else
- tip_frame = Qnil;
+ x_make_frame_invisible (f);
+
+ was_open = Qt;
}
else
tip_frame = Qnil;
}
+ else
+ tip_frame = Qnil;
return unbind_to (count, was_open);
}
@@ -6721,7 +6728,10 @@ with offset DY added (default is -10).
if (SCHARS (string) == 0)
string = make_unibyte_string (" ", 1);
+ if (NILP (frame))
+ frame = selected_frame;
f = decode_window_system_frame (frame);
+
if (NILP (timeout))
timeout = make_number (5);
else
next prev parent reply other threads:[~2018-02-09 9:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 22:26 bug#30399: 27.0.50; tooltips are broken Stephen Berman
2018-02-09 9:53 ` martin rudalics [this message]
2018-02-09 10:49 ` Stephen Berman
2018-02-10 9:47 ` martin rudalics
2018-02-09 15:41 ` Drew Adams
2018-02-10 9:47 ` martin rudalics
2018-02-10 16:39 ` Drew Adams
2018-02-11 9:36 ` martin rudalics
2018-02-11 17:23 ` Drew Adams
2018-02-12 9:26 ` martin rudalics
2018-02-12 14:43 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5A7D6F9A.1010504@gmx.at \
--to=rudalics@gmx.at \
--cc=30399@debbugs.gnu.org \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).