bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#22549: 25.0.50; Tooltips placed outside of screen limits


From: martin rudalics
Subject: bug#22549: 25.0.50; Tooltips placed outside of screen limits
Date: Sat, 06 Feb 2016 10:30:38 +0100

> The first problem with the patch is that it crashes when there is not an
> Emacs frame on some of the monitors. This is solved changing the `if'
> to:
>
>            if (CONSP (frames) && !NILP (XCDR (frames))
>                && EQ (frame, XCAR (XCDR (frames))))

Silly me.  I was looking for Fcadr, didn't find it and just grabbed
whatever there was without thinking of the consequences.

Translating code back from Elisp to C is a PITA.  And I don't want to
tear apart ‘x-display-monitor-attributes-list’ for the present purpose,
especially not on Emacs-25.  Maybe I can convince Yamamoto Mitsuharu to
provide a C-friendly interface for master.

> The next problem is that the condition
>
> EQ (frame, XCAR (XCDR (frames)))
>
> is always false, which makes sense because `frame' is the tooltip frame
> (unless I'm misunderstanding what XSETFRAME does) and it is not listed
> on `frames'.

Another silliness.  With GTK, FRAME is the original frame and I stepped
through this with GDB on a GTK build only and it obviously worked.  With
Lucid, FRAME is the tooltip frame and I just looked at the results which
were OK since I have only one monitor.

> For going ahead I "corrected" this with
>
>        struct frame *sf = XFRAME (selected_frame);
>        XSETFRAME (frame, sf);
>
> which is wrong when there is more than one frame, because the tooltip
> may be shown for a frame that is not the selected one (showing tooltips
> for other than the selected frame seems inappropriate to me, but that's
> how Emacs behaves right now).

Maybe someone will find a use case for it.  Let's not bother now but
simply agree that the selected frame might be on another monitor and so
could be the wrong frame.

> Then, as the comparision only takes into account the first frame listed
> on `frames', even if `frame' where correct (the frame that triggered the
> tooltip) it could fail when there is more than one Emacs frame on the
> same monitor.

I don't understand you here.  There can be any number of frames on the
"right" monitor.  The important thing is to get the monitor of the frame
where the tooltip shall be shown.

> I observed that the tooltip is correctly placed when the right
> conditions (see below) are satisfied.
>
> What is missing is to determine the parent frame of the tooltip frame,

... that's the one passed via FRAME to ‘x-show-tip’ and we just have to
pass it on to compute_tip_xy ...

> instead of using just the selected one as I did, and to search for that
> frame on the list of frames associated to the current monitor, instead
> of just testing the first frame on the list.

martin






reply via email to

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