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: martin rudalics
Subject: Re: How to create a small child-frame which only show two lines
Date: Tue, 12 Dec 2017 09:56:19 +0100

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

martin



reply via email to

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