From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Fix some tooltip related problems Date: Wed, 10 Jan 2018 23:04:26 +0000 Message-ID: <20180110230426.GB16679@breton.holly.idiocy.org> References: <5A533FA4.4030507@gmx.at> <9384bae5-cbb9-4b4d-ac5c-1d01f01c8117@default> <5A53B633.5020706@gmx.at> <41d40db5-15d8-4b2c-a058-fb6dabc8bfd3@default> <5A548E7E.2040601@gmx.at> <5A55E8ED.1010602@gmx.at> <475d480b-3885-4779-ae46-09cf7fbbcee7@default> <20180110191755.GA79229@breton.holly.idiocy.org> <329fad14-bed5-409a-828c-facec2e4be35@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="GRPZ8SYKNexpdSJ7" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1515625404 30046 195.159.176.226 (10 Jan 2018 23:03:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 10 Jan 2018 23:03:24 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) Cc: martin rudalics , emacs-devel To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 11 00:03:20 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZPOx-0007OY-5v for ged-emacs-devel@m.gmane.org; Thu, 11 Jan 2018 00:03:19 +0100 Original-Received: from localhost ([::1]:47515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZPQw-0004XH-Uf for ged-emacs-devel@m.gmane.org; Wed, 10 Jan 2018 18:05:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZPQ4-0004V4-0g for emacs-devel@gnu.org; Wed, 10 Jan 2018 18:04:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZPQ2-0002jf-MU for emacs-devel@gnu.org; Wed, 10 Jan 2018 18:04:27 -0500 Original-Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:43209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eZPQ2-0002iM-Aw for emacs-devel@gnu.org; Wed, 10 Jan 2018 18:04:26 -0500 Original-Received: by mail-wm0-x233.google.com with SMTP id g1so1967045wmg.2 for ; Wed, 10 Jan 2018 15:04:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=C3UnkxsrnfmGoEcxbgv2zFhvGYN1mMk3L5bjVUp9w28=; b=A5NuAcr2cc4QI53ly1oioLSCeubGXyAUs7zlUA3JitChlMnlLVq3HJDGGvmMU6bVsq 0ZL3SfbEBfMSw4fcaHefh8Ct08713njgbuevkYelR9Ligwphz9XtIM8E/AwYUkjVKVeE Bco3DrKLwsFdrMquSGWNrKSFb2JAGDmOnWOUwXy2DoNwhI03+3QFDMeBuQ13+1JLM3Wh wfKZ5jeXvzywr8N6YPzYm4Df/rRkqWfozANaApq7pLP84MYoGvD3tUCTv81Wur6fKuRa logePwTK+E3O5KOnMUhOJm1CHl7rZziegt2agMuqIQnbTe/6NZaOMGK0Kffj+U/GTx5g Fcig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=C3UnkxsrnfmGoEcxbgv2zFhvGYN1mMk3L5bjVUp9w28=; b=mCfIYVKOIj8jAUFqIkcEGMqN3/7MOsxGFOxDI94KLHmPYS/s3hle57urAOW5xRdJb3 rYwHgufzt1+ss8m1YuDmQJ3JA6ea6e6kklc+18qbmrchZh5k0XkTD8u4+ZGf4FsAgLCz IZA1i17UHngVYfUny1HdWj6n9fUqATdrxvITjFXTImYfue/EjXjL3pkotmPJRJiWWEju aiqULBi9SkTab5XIrcqazvAYJMrr5dI3aoEgqQZcNE0ikxnyhVNS7LkM/egUq5b8GGXL NxwH+3bFUu/fcLP05wmHAAVBm3xKrz0vCyKuMc+MtGX9jSfvGlo/u+LWvOeisMDgNS+H w9Qg== X-Gm-Message-State: AKGB3mJv13esvb+VzAoqYC+qBZBgKbFlE7OYGfY/ZhnD6nslFUdFASwA qQ65XhzZ/WmcWslOktcH5MU= X-Google-Smtp-Source: ACJfBotgUWrViHTUbrz/dEVryAWfH3g5pP6F3UBk6K8PIQQz3Wdn77f8EMJapErfXRi4maUxPDOvUA== X-Received: by 10.28.160.23 with SMTP id j23mr16044388wme.109.1515625465081; Wed, 10 Jan 2018 15:04:25 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-0c9f-d078-0073-e913.holly.idiocy.org. [2001:8b0:3f8:8129:c9f:d078:73:e913]) by smtp.gmail.com with ESMTPSA id n11sm13107376wre.44.2018.01.10.15.04.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 15:04:24 -0800 (PST) Content-Disposition: inline In-Reply-To: <329fad14-bed5-409a-828c-facec2e4be35@default> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221817 Archived-At: --GRPZ8SYKNexpdSJ7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --GRPZ8SYKNexpdSJ7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Implement-rubbish-frame-base-tooltips.patch" >From 36a9a38619d2b1658a2ee4b96faa89a2b17843ae Mon Sep 17 00:00:00 2001 From: Alan Third 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 --GRPZ8SYKNexpdSJ7--