Subject: Re: bug#26905: 25.2: MacOS: tooltips show in wrong display

From: Alan Third <[email-masked]>
Date: Sat, 13 May 2017 16:28:21 +0100

On Sat, May 13, 2017 at 11:02:04AM +0200, Charles A. Roelli wrote:
> I notice now, though, that the tooltip can end up partially offscreen, both
> with and without the above change (e.g. when you create a tooltip with the
> mouse pointer at the right edge of the primary monitor).  IIRC on GNU/Linux
> the tooltip is adjusted to fit on screen.  Maybe this adjustment works on
> newer versions of OS X?

I was thinking about this earlier and I suspect that if we want to
avoid tooltips crossing monitors we’ll have to step through each
screen in [NSScreen screens], check if `pt` is within it’s bounds, and
when we find the right screen, use it’s origin and frame to calculate
the min/max x/y.

constrain_frame_rect in nsterm.m does something similar already.

There’s a method in CGRect called CGRectContainsPoint, which should
help us here, as NSRect is really just a CGRect. Unfortunately it
doesn’t appear to be available in GNUstep, so it may be necessary to
implement the check ourselves.

If we don’t care about spanning monitors, I think we still need to
step through each screen and calculate the overall min/max values.

What do you think?
-- 
Alan Third