Subject: bug#31546: 27.0.50; macOS child frames with no mode-line mouse click problem

From: Aaron Jensen <[email-masked]>
Date: Sun, 27 May 2018 14:53:28 -0700

On Sun, May 27, 2018 at 2:24 PM Alan Third <[email-masked]> wrote:
> *sigh* try this:

> modified   src/nsterm.m
> @@ -2547,7 +2547,7 @@ so some key presses (TAB) are swallowed by the
system. */

>     if (f && FRAME_NS_P (f))
>       {
> -      view = FRAME_NS_VIEW (*fp);
> +      view = FRAME_NS_VIEW (f);

>         position = [[view window] mouseLocationOutsideOfEventStream];
>         position = [view convertPoint: position fromView: nil];

AFAICT, that fixes it even w/o my patch. Thanks!

There's still some weirdness w/ company-childframe, but I believe it's
fixable in that package.

That said, I think my patch is still necessary to prevent a related, but
not very critical issue. Using my original repro but with no-accept-focus
nil:

(progn
   (let ((buffer (get-buffer " *foo*")))
     (when (buffer-live-p buffer)
       (kill-buffer buffer)))
   (let ((buffer (get-buffer-create " *foo*"))
         (after-make-frame-functions nil))
     (with-current-buffer buffer
       (goto-char (point-min))
       (insert "1 This is a test\n2 This is a test\n3 This is a test")
       (delete-region (point) (point-max))

       (setq-local resize-mini-windows nil)
       (setq-local mode-line-format nil)
       (setq-local repro-frame
                   (make-frame
                    `(
                      (minibuffer . nil)
                      )
                    ))
       (let ((win (frame-root-window repro-frame)))
         (set-window-parameter win 'mode-line-format nil)
         (set-window-buffer win buffer)))))

Click in the middle of the window and slowly move the mouse towards the
bottom of the window. As soon as you leave the bottom of the window, it
will scroll two lines, I believe because it has miscalculated the bottom.
If you apply my patch, it will only scroll one line at a time, which seems
to be the normal behavior when the mode-line is present.

I would guess this is reproducible in X as well.