Subject: Re: bug#25818: 25.2; frame moved off display does not return (OS X)

From: [email-masked] (Charles A. Roelli)
Date: Mon, 27 Feb 2017 11:34:20 +0100

On Mon, Feb 27 2017 at 09:05:14 am, martin rudalics wrote:

>> No, I did not; thanks for the reminder.  In 24.3, with a second monitor
>> plugged in, (display-pixel-width) returns 1280, i.e. the width only of
>> my primary monitor.  In 24.4, in the same situation,
>> (display-pixel-width) returns 2330 = (+ 1280 1050).  Second monitor is
>> 1050 pixels wide.
>
> So the problem occurs only with the second monitor plugged in?

The problem occurs (in 24.4) regardless of how many monitors are plugged
in, and it may not be directly related to `display-pixel-width'.

>
>> In both the case of 24.3 and 24.4 with no external monitor attached,
>> (display-pixel-width) returns 1280.
>
> And there is no problem in this case with 24.4?

No, as above, the problem always occurs with 24.4, regardless of the
number of monitors connected.

>
>> So it seems that the code for `display-pixel-width' (or code that it
>> calls) was changed between those releases, maybe to support multiple
>> monitors.
>
> The code was changed in two tranches
>
> 2013-05-20  YAMAMOTO Mitsuharu  <[email-masked]>
>
> 2013-07-04  YAMAMOTO Mitsuharu  <[email-masked]>
>
> I'll CC him - maybe he can help us solving this issue in a more general
> way.

Thanks.

>
>> I notice now that when running the test form on 24.3, the created frame
>> never actually leaves the visible portion of the screen.  For example,
>> when the code calls (sleep-for 1) with the frame supposedly being
>> offscreen according to its frame parameters (right before step 2), the
>> frame is in reality maybe 50 pixels left of the screen's right edge.
>> This is with just one monitor.  When I run the example with two
>> monitors, the frame just spills into the second monitor but does not go
>> further (since 24.3 does not seem to give correct values for
>> `display-pixel-width' with multiple monitors).
>
> Do you mean that the value is already wrong for the primary monitor or
> that the value simply does not account for the second monitor?

The value does not account for the second monitor (but is correct for
the primary monitor).  This is the behavior that was fixed in 24.4.

>> So it seems like there used to be code in Emacs that prevented a frame
>> from programmatically leaving the screen area in OS X.  For example, in
>> 24.3, if I call (modify-frame-parameters nil '((left . 10000))), the
>> frame is put, as above, about 50 pixels left of the screen's right edge.
>
> In any case we have to change ediff-wind.el in order to fix the issue at
> hand.

We could, but it would be better to restore Emacs 24.3's behavior in OS
X, where frames are effectively prevented from moving off-screen.  There
is no point in allowing a frame to be moved off-screen, IIUC, since the
frame seems to never reappear no matter what we do with it.

> martin