all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: martin rudalics <rudalics@gmx.at>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Fix some tooltip related problems
Date: Wed, 10 Jan 2018 23:04:26 +0000	[thread overview]
Message-ID: <20180110230426.GB16679@breton.holly.idiocy.org> (raw)
In-Reply-To: <329fad14-bed5-409a-828c-facec2e4be35@default>

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

On Wed, Jan 10, 2018 at 01:02:42PM -0800, Drew Adams wrote:
>    Given that limitation, I repeat the question: Can't we
>    use a ("normal") Emacs frame, where things such as faces
>    do work, to implement tooltips?

I believe it should be possible now we have undecorated frames
available. I’ve made a (really bad) attempt at proving we can do it.
Patch attached.

My emacs lisp skills are rather bad, so I couldn’t work out how to get
tooltip-hide to work, or how exactly I should set the size of the
tooltip, or how to not display the modeline, but it kind of works...
Someone who knows what they’re doing should be able to make a better
fist of it than me.

One possible issue is that it might be difficult to stop frame‐based
tooltips from crossing screens on multi‐monitor setups. I know we fix
that in Objective‐C code in NS, I don’t know if lisp knows enough
about screen geometry to get round it.

(BTW, I just noticed that under NS toolbar tooltips are native, while
other tooltips aren’t.)

>    Did someone have to explain to you what a dimmed menu item
>    is all about?  Is that inherently confusing the first time
>    someone sees it?  I think not.  A tooltip with dimmed text
>    is no more confusing.

I disagree, a menu item is interactive, or not if it’s dimmed, so it
becomes clear quite quickly what dimming means. A dimmed tooltip is
still a tooltip, just a bit harder to read. It takes further action to
discover that the information its giving you isn’t currently usable.

-- 
Alan Third

[-- Attachment #2: 0001-Implement-rubbish-frame-base-tooltips.patch --]
[-- Type: text/plain, Size: 2928 bytes --]

From 36a9a38619d2b1658a2ee4b96faa89a2b17843ae Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Wed, 10 Jan 2018 23:03:36 +0000
Subject: [PATCH] Implement rubbish frame-base tooltips

---
 lisp/tooltip.el | 45 +++++++++++++++++++++++++++++++++++++++------
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 81df229a13..2117d2aaa3 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -190,6 +190,8 @@ tooltip-hide-time
 
 (defvar gud-tooltip-mode) ;; Prevent warning.
 
+(defvar tooltip-frame)
+
 ;;; Event accessors
 
 (defun tooltip-event-buffer (event)
@@ -262,12 +264,41 @@ tooltip-show
 	    (setf (alist-get 'border-color params) fg))
 	  (when (stringp bg)
 	    (setf (alist-get 'background-color params) bg))
-	  (x-show-tip (propertize text 'face 'tooltip)
-		      (selected-frame)
-		      params
-		      tooltip-hide-delay
-		      tooltip-x-offset
-		      tooltip-y-offset))
+          (let* ((buf (get-buffer-create "*tooltip*"))
+                 (frame (make-frame
+                         (append
+                          `((no-focus-on-map . t)
+                            (undecorated . t)
+                            (tool-bar-lines . 0)
+	                    (menu-bar-lines . 0)
+	                    (minibuffer . nil)
+	                    (vertical-scroll-bars . nil)
+	                    (horizontal-scroll-bars . nil)
+	                    (left-fringe . 0)
+	                    (right-fringe . 0))
+                          (if (not (alist-get 'left params))
+                              `((left . ,(+ tooltip-x-offset (car (mouse-absolute-pixel-position)))))
+                            '())
+                          (if (not (alist-get 'top params))
+                              `((top . ,(+ tooltip-y-offset (cdr (mouse-absolute-pixel-position)))))
+                            '())
+                          params))))
+            (with-current-buffer buf
+              (erase-buffer)
+              (insert (propertize text 'face 'tooltip)))
+            (set-window-buffer (frame-root-window frame) buf)
+            (setq tooltip-frame frame)
+            (run-at-time tooltip-hide-delay nil
+                         (lambda () (delete-frame tooltip-frame))))
+
+
+	  ;; (x-show-tip (propertize text 'face 'tooltip)
+	  ;;             (selected-frame)
+	  ;;             params
+	  ;;             tooltip-hide-delay
+	  ;;             tooltip-x-offset
+	  ;;             tooltip-y-offset))
+          )
       (error
        (message "Error while displaying tooltip: %s" error)
        (sit-for 1)
@@ -279,6 +310,8 @@ tooltip-hide
   "Hide a tooltip, if one is displayed.
 Value is non-nil if tooltip was open."
   (tooltip-cancel-delayed-tip)
+  ;; (if (not (null tooltip-frame))
+  ;;     (delete-frame tooltip-frame))
   (when (x-hide-tip)
     (setq tooltip-hide-time (float-time))))
 
-- 
2.14.3


  reply	other threads:[~2018-01-10 23:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08  9:53 Fix some tooltip related problems martin rudalics
2018-01-08 14:41 ` Drew Adams
2018-01-08 18:19   ` martin rudalics
2018-01-08 18:50     ` Drew Adams
2018-01-09  9:42       ` martin rudalics
2018-01-09 15:08         ` Drew Adams
2018-01-10 10:20           ` martin rudalics
2018-01-10 15:55             ` Drew Adams
2018-01-10 19:17               ` Alan Third
2018-01-10 21:02                 ` Drew Adams
2018-01-10 23:04                   ` Alan Third [this message]
2018-01-10 23:26                     ` Drew Adams
2018-01-11  3:39                   ` Eli Zaretskii
2018-01-11  7:03                 ` Yuri Khan
2018-01-11 14:32                   ` Drew Adams
2018-01-11 10:56               ` martin rudalics
2018-01-11 14:42                 ` Drew Adams
2018-01-11 17:06                   ` martin rudalics
2018-01-11 17:19                     ` Robert Pluim
2018-01-11 17:59                       ` Eli Zaretskii
2018-01-11 18:20                         ` martin rudalics
2018-01-11 23:33                         ` Daniele Nicolodi
2018-01-12  8:38                           ` Eli Zaretskii
2018-01-12  8:40                         ` Robert Pluim
2018-01-12  9:55                           ` Eli Zaretskii
2018-01-12 13:57                             ` Robert Pluim
2018-01-12 14:15                               ` Philipp Stephani
2018-01-11 19:54                       ` Richard Stallman
2018-01-11 23:26                       ` Stefan Monnier
2018-01-12  8:48                         ` Robert Pluim
2018-01-11 18:09                     ` Drew Adams
2018-01-11 18:54                       ` martin rudalics
2018-01-11 19:50                         ` Drew Adams
2018-01-12  8:47                           ` martin rudalics
2018-01-12 16:43                             ` Drew Adams
2018-01-08 18:47 ` Eli Zaretskii
2018-01-08 19:06   ` martin rudalics
2018-01-08 19:22     ` Eli Zaretskii
2018-01-09  9:42       ` martin rudalics
2018-01-19 18:54 ` martin rudalics

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180110230426.GB16679@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.