unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Feng Shu" <tumashu@163.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Feng Shu <tumashu@163.com>, emacs-devel@gnu.org
Subject: Re: How to create a small child-frame which only show two lines
Date: Tue, 12 Dec 2017 20:19:33 +0800	[thread overview]
Message-ID: <87d13kqgtm.fsf@163.com> (raw)
In-Reply-To: <5A2F99B3.6000800@gmx.at> (martin rudalics's message of "Tue, 12 Dec 2017 09:56:19 +0100")

martin rudalics <rudalics@gmx.at> writes:

>> (defun pyim-tooltip-compute-pixel-position
>>      (&optional pos window pixel-width pixel-height dx dy)
>>    "Return pixel position of POS in WINDOW, which indicates relative
>> coordinates of bottom left corner of the object, its returned value is
>> like (X . Y)
>
> For mouse positions we return the upper left corner and in addition the
> width and height of the object at point (where the height value would
> inherently use the height of the entire line the object is part of).  I
> think we should do the same here.  If the object is on top of the window
> and partially off-screen, we'd probably have to return a negative
> vertical position value.
>
>> If PIXEL-WIDTH and PIXEL-HEIGHT are given, this function regard these
>> values as the size of a small window located around the POS, for example:
>> tooltip. These values are used to adjust the small window's location and
>> let it not disappear by sticking out of the display.
>
> IIUC your code avoids tooltips "sticking out of the frame".  Right?  In
> either case you'd narrow the semantics and maybe something more general
> should be used.
>
>> DX specifies horizontal offset in pixel.
>>
>> DY specifies vertical offset in pixel. This makes the calculations done
>> without considering the height of object at POS, so the object might be
>> hidden by the tooltip.
>
> IIUC these are needed for the "sticking out of the frame" avoidance.
> Right?  Because otherwise they should not be part of such a function.
>
> A more general solution would allow to position the tooltip at either of
> the four corners of the object at POS (for example, I'd prefer to put
> them on an empty line that might happen to be above or below the glyph
> at POS).
>
>>                                 (and (redisplay t)
>>                                      (window-line-height line window)))))
>
> I'm never sure whether this is sufficient or `force-window-update' would
> be needed too.  These days, `redisplay' has a quite confusing doc-string
> wrt `redisplay-dont-pause' which makes me doubt even more.
>
>>                        ;; `posn-object-width-height' returns an incorrect value
>>                        ;; when the header line is displayed (Emacs bug #4426).
>
> FWIW this bug should have been fixed more than six years ago.
>

To be honest, I do not understand the function very much, I only know it
just work :-), for this function is copied from pos-tip.el five years
ago's version, maybe many code of it just dead code.

pos-tip is a package which has similar job with popup-el, the different
is that pos-tip use tooltip while popup-el use overlay.  popup-el is
very popular but it does not run well with No-English language,
pos-tip has not this problem but it run too slow and unmaintaned
five years ago.

I find we can use child-frame to create a popup-el like package, which
is fast, easy understand and works well with No-English language.



> martin
>

-- 




  reply	other threads:[~2017-12-12 12:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07  0:04 How to create a small child-frame which only show two lines tumashu
2017-12-07  2:35 ` jun
2017-12-07  2:45   ` tumashu
2017-12-07  9:27 ` How " martin rudalics
2017-12-08 10:12   ` martin rudalics
2017-12-08 12:05     ` tumashu
2017-12-09 10:35       ` martin rudalics
2017-12-11  0:21         ` tumashu
2017-12-11  6:42           ` martin rudalics
2017-12-11  8:29             ` tumashu
2017-12-11 15:29               ` Eli Zaretskii
2017-12-12  0:43                 ` tumashu
2017-12-12  3:22                   ` Stefan Monnier
2017-12-12  8:56                     ` martin rudalics
2017-12-12 16:26                   ` Eli Zaretskii
2017-12-12 16:48                     ` Stefan Monnier
2017-12-12 17:19                       ` Eli Zaretskii
2018-01-07  2:56                 ` Feng Shu
2017-12-12  8:56               ` martin rudalics
2017-12-12 12:19                 ` Feng Shu [this message]
2017-12-12 17:05                 ` Eli Zaretskii
2017-12-13  8:50                   ` martin rudalics
2018-01-06 10:42                 ` Feng Shu

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=87d13kqgtm.fsf@163.com \
    --to=tumashu@163.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 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).