unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
@ 2020-03-12 21:54 Dustin Lacewell
  2020-03-13  8:18 ` Eli Zaretskii
  2020-03-13 15:17 ` Alan Third
  0 siblings, 2 replies; 11+ messages in thread
From: Dustin Lacewell @ 2020-03-12 21:54 UTC (permalink / raw)
  To: 40047

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

--text follows this line--

It appears that images in tooltip-mode tooltips is currently broken on
most platforms besides windows. The following snippet should provide an
example:

(defun my-download-as-string (url)
  "Download file from URL and return it as string."
  (let ((image-buf (url-retrieve-synchronously url)))
    (when image-buf
      (with-current-buffer image-buf
        (goto-char (point-min))
        (when (looking-at "HTTP/")
          (delete-region (point-min)
                         (progn (re-search-forward "\n[\n]+")
                                (point))))
        (buffer-substring-no-properties (point-min) (point-max))))))

(defun my-download-image (url)
  "Download URL as image."
  (create-image (my-download-as-string url) (image-type-from-file-name url)
t))

(with-current-buffer (get-buffer-create "*TooltipTest*")
  (tooltip-mode)
  (insert
   (propertize "Facepalm" 'help-echo
               (propertize " " 'display
                           (my-download-image "
https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Paris_Tuileries_Garden_Facepalm_statue.jpg/300px-Paris_Tuileries_Garden_Facepalm_statue.jpg
"))))
  (display-buffer (current-buffer)))

Just `eval-buffer` then hover your mouse over `Facepalm` in the new
buffer.

Emacs versions 26.2 26.3 and 28.0.50 were tested on NixOS, Ubuntu, OSX
and Windows.

On Windows a tooltip displays an image. On Linux (NixOS, Ubuntu) and OSX
only a small empty tooltip is presented.

One package I was able to identify that uses this behavior is Dired+

This feature is also useful in general to maintain the readability of
org-mode documents for example.

[-- Attachment #2: Type: text/html, Size: 2133 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-12 21:54 bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX Dustin Lacewell
@ 2020-03-13  8:18 ` Eli Zaretskii
  2020-03-13 12:11   ` Stephen Berman
  2020-03-13 15:17 ` Alan Third
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2020-03-13  8:18 UTC (permalink / raw)
  To: Dustin Lacewell; +Cc: 40047

> From: Dustin Lacewell <dlacewell@gmail.com>
> Date: Thu, 12 Mar 2020 16:54:26 -0500
> 
> Just `eval-buffer` then hover your mouse over `Facepalm` in the new
> buffer.
> 
> Emacs versions 26.2 26.3 and 28.0.50 were tested on NixOS, Ubuntu, OSX
> and Windows.
> 
> On Windows a tooltip displays an image. On Linux (NixOS, Ubuntu) and OSX
> only a small empty tooltip is presented.

If, in the GNU/Linux build, you set x-gtk-use-system-tooltips to nil,
does the problem go away?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-13  8:18 ` Eli Zaretskii
@ 2020-03-13 12:11   ` Stephen Berman
  2020-03-13 14:24     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Berman @ 2020-03-13 12:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 40047, Dustin Lacewell

On Fri, 13 Mar 2020 10:18:06 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Dustin Lacewell <dlacewell@gmail.com>
>> Date: Thu, 12 Mar 2020 16:54:26 -0500
>>
>> Just `eval-buffer` then hover your mouse over `Facepalm` in the new
>> buffer.
>>
>> Emacs versions 26.2 26.3 and 28.0.50 were tested on NixOS, Ubuntu, OSX
>> and Windows.
>>
>> On Windows a tooltip displays an image. On Linux (NixOS, Ubuntu) and OSX
>> only a small empty tooltip is presented.
>
> If, in the GNU/Linux build, you set x-gtk-use-system-tooltips to nil,
> does the problem go away?

It does for me.  That is, I'm running GNU/Linux and with
x-gtk-use-system-tooltips set to t, I don't see the image, but with it
set to nil, I do.

Steve Berman





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-13 12:11   ` Stephen Berman
@ 2020-03-13 14:24     ` Eli Zaretskii
  2020-03-13 15:00       ` Dustin Lacewell
  2020-03-14  8:49       ` martin rudalics
  0 siblings, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2020-03-13 14:24 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 40047, dlacewell

> From: Stephen Berman <stephen.berman@gmx.net>
> Cc: Dustin Lacewell <dlacewell@gmail.com>,  40047@debbugs.gnu.org
> Date: Fri, 13 Mar 2020 13:11:31 +0100
> 
> > If, in the GNU/Linux build, you set x-gtk-use-system-tooltips to nil,
> > does the problem go away?
> 
> It does for me.  That is, I'm running GNU/Linux and with
> x-gtk-use-system-tooltips set to t, I don't see the image, but with it
> set to nil, I do.

Thanks for testing.  So I guess the problem is that we fail to
instruct the native tooltips to display the image or use the correct
dimensions, for some reason, and the problem doesn't exist on Windows
because we always use our own code for tooltips there.

Patches to fix the native case are welcome.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-13 14:24     ` Eli Zaretskii
@ 2020-03-13 15:00       ` Dustin Lacewell
  2020-03-14  8:49       ` martin rudalics
  1 sibling, 0 replies; 11+ messages in thread
From: Dustin Lacewell @ 2020-03-13 15:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 40047, Stephen Berman

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

(Sorry if I am replying incorrectly by replying to all...)

> > If, in the GNU/Linux build, you set x-gtk-use-system-tooltips to nil,
> > does the problem go away?
>
> It does for me.  That is, I'm running GNU/Linux and with
> x-gtk-use-system-tooltips set to t, I don't see the image, but with it
> set to nil, I do.

I can confirm this as well!

On Fri, Mar 13, 2020 at 9:25 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Stephen Berman <stephen.berman@gmx.net>
> > Cc: Dustin Lacewell <dlacewell@gmail.com>,  40047@debbugs.gnu.org
> > Date: Fri, 13 Mar 2020 13:11:31 +0100
> >
> > > If, in the GNU/Linux build, you set x-gtk-use-system-tooltips to nil,
> > > does the problem go away?
> >
> > It does for me.  That is, I'm running GNU/Linux and with
> > x-gtk-use-system-tooltips set to t, I don't see the image, but with it
> > set to nil, I do.
>
> Thanks for testing.  So I guess the problem is that we fail to
> instruct the native tooltips to display the image or use the correct
> dimensions, for some reason, and the problem doesn't exist on Windows
> because we always use our own code for tooltips there.
>
> Patches to fix the native case are welcome.
>

[-- Attachment #2: Type: text/html, Size: 1891 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-12 21:54 bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX Dustin Lacewell
  2020-03-13  8:18 ` Eli Zaretskii
@ 2020-03-13 15:17 ` Alan Third
  2020-03-13 15:57   ` Eli Zaretskii
  1 sibling, 1 reply; 11+ messages in thread
From: Alan Third @ 2020-03-13 15:17 UTC (permalink / raw)
  To: Dustin Lacewell; +Cc: 40047

On Thu, Mar 12, 2020 at 04:54:26PM -0500, Dustin Lacewell wrote:
> --text follows this line--
> 
> It appears that images in tooltip-mode tooltips is currently broken on
> most platforms besides windows. The following snippet should provide an
> example:
<snip>
> On Windows a tooltip displays an image. On Linux (NixOS, Ubuntu) and OSX
> only a small empty tooltip is presented.

On macOS the tooltips are extremely basic and don’t support anything
other than a few colour options and possibly a change of font.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-13 15:17 ` Alan Third
@ 2020-03-13 15:57   ` Eli Zaretskii
  2020-03-13 23:17     ` Alan Third
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2020-03-13 15:57 UTC (permalink / raw)
  To: Alan Third; +Cc: 40047, alan, dlacewell

> Date: Fri, 13 Mar 2020 16:17:25 +0100 (CET)
> From: Alan Third <alan@idiocy.org>
> Cc: 40047@debbugs.gnu.org
> 
> On macOS the tooltips are extremely basic and don’t support anything
> other than a few colour options and possibly a change of font.

Can Emacs on macOS use its own tooltip code?  If so, perhaps we should
make that the default on macOS?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-13 15:57   ` Eli Zaretskii
@ 2020-03-13 23:17     ` Alan Third
  2020-03-14  8:12       ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Third @ 2020-03-13 23:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 40047, dlacewell

On Fri, Mar 13, 2020 at 05:57:30PM +0200, Eli Zaretskii wrote:
> > Date: Fri, 13 Mar 2020 16:17:25 +0100 (CET)
> > From: Alan Third <alan@idiocy.org>
> > Cc: 40047@debbugs.gnu.org
> > 
> > On macOS the tooltips are extremely basic and don’t support anything
> > other than a few colour options and possibly a change of font.
> 
> Can Emacs on macOS use its own tooltip code?  If so, perhaps we should
> make that the default on macOS?

You mean the basic toolkit tooltips? It should be able to. I get the
impression custom tooltips were originally only implemented so they
could have a yellow background like on other terms.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-13 23:17     ` Alan Third
@ 2020-03-14  8:12       ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2020-03-14  8:12 UTC (permalink / raw)
  To: Alan Third; +Cc: 40047, dlacewell

> Date: Sat, 14 Mar 2020 00:17:25 +0100 (CET)
> From: Alan Third <alan@idiocy.org>
> Cc: 40047@debbugs.gnu.org, dlacewell@gmail.com
> 
> On Fri, Mar 13, 2020 at 05:57:30PM +0200, Eli Zaretskii wrote:
> > > Date: Fri, 13 Mar 2020 16:17:25 +0100 (CET)
> > > From: Alan Third <alan@idiocy.org>
> > > Cc: 40047@debbugs.gnu.org
> > > 
> > > On macOS the tooltips are extremely basic and don’t support anything
> > > other than a few colour options and possibly a change of font.
> > 
> > Can Emacs on macOS use its own tooltip code?  If so, perhaps we should
> > make that the default on macOS?
> 
> You mean the basic toolkit tooltips?

Not sure what you mean by that.  I meant the tooltips w implement in
Emacs's own code, whereby a tooltip is a special kind of frame.

> It should be able to. I get the impression custom tooltips were
> originally only implemented so they could have a yellow background
> like on other terms.

The tooltips implemented in Emacs's own code also have a yellow
background.  And it's a frame, so the faces we use there can be
customized, see tooltip-frame-parameters.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-13 14:24     ` Eli Zaretskii
  2020-03-13 15:00       ` Dustin Lacewell
@ 2020-03-14  8:49       ` martin rudalics
  2020-03-14 10:11         ` Eli Zaretskii
  1 sibling, 1 reply; 11+ messages in thread
From: martin rudalics @ 2020-03-14  8:49 UTC (permalink / raw)
  To: Eli Zaretskii, Stephen Berman; +Cc: 40047, dlacewell

 > Thanks for testing.  So I guess the problem is that we fail to
 > instruct the native tooltips to display the image or use the correct
 > dimensions, for some reason, and the problem doesn't exist on Windows
 > because we always use our own code for tooltips there.
 >
 > Patches to fix the native case are welcome.

The native case is neither broken nor can it be fixed.  Tooltips like
those provided by GTK, Windows or many desktops are supposed to provide
a uniform look across all sorts of applications that use them so that
the user can easily recognize tooltips as what they are.  That's why they
usually have customizable backgrounds, fonts and borders.  Applications
are not supposed to meddle with them.

martin





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
  2020-03-14  8:49       ` martin rudalics
@ 2020-03-14 10:11         ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2020-03-14 10:11 UTC (permalink / raw)
  To: martin rudalics; +Cc: 40047, stephen.berman, dlacewell

> Cc: 40047@debbugs.gnu.org, dlacewell@gmail.com
> From: martin rudalics <rudalics@gmx.at>
> Date: Sat, 14 Mar 2020 09:49:24 +0100
> 
> The native case is neither broken nor can it be fixed.  Tooltips like
> those provided by GTK, Windows or many desktops are supposed to provide
> a uniform look across all sorts of applications that use them so that
> the user can easily recognize tooltips as what they are.  That's why they
> usually have customizable backgrounds, fonts and borders.  Applications
> are not supposed to meddle with them.

So you are saying the native tooltips cannot usefully display images?
I'd be surprised, but if that is indeed so, we should at least
document that, so users who do want images in tooltips could switch to
our tooltips.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-03-14 10:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-12 21:54 bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX Dustin Lacewell
2020-03-13  8:18 ` Eli Zaretskii
2020-03-13 12:11   ` Stephen Berman
2020-03-13 14:24     ` Eli Zaretskii
2020-03-13 15:00       ` Dustin Lacewell
2020-03-14  8:49       ` martin rudalics
2020-03-14 10:11         ` Eli Zaretskii
2020-03-13 15:17 ` Alan Third
2020-03-13 15:57   ` Eli Zaretskii
2020-03-13 23:17     ` Alan Third
2020-03-14  8:12       ` Eli Zaretskii

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).