emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create a small child-frame which only show two lines


From: Feng Shu
Subject: Re: How to create a small child-frame which only show two lines
Date: Tue, 12 Dec 2017 20:19:33 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

martin rudalics <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]