unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Aaron Jensen <aaronjensen@gmail.com>
Cc: 31546@debbugs.gnu.org
Subject: bug#31546: 27.0.50; macOS child frames with no mode-line mouse click problem
Date: Sun, 27 May 2018 22:24:29 +0100	[thread overview]
Message-ID: <20180527212429.GA19272@breton.holly.idiocy.org> (raw)
In-Reply-To: <CAHyO48xG0fHH66jLaG4iwEoW8+wuR_hDp4e1fYeFjsQt0nhN3g@mail.gmail.com>

On Sun, May 27, 2018 at 11:52:36AM -0700, Aaron Jensen wrote:
> One more clue: On a frame that doesn't accept focus on a mac, a
> single click results in a mouse-movement getting fired immediately
> after the down-mouse-1. A single click on a normal frame does not do
> this. This is why this issue doesn't repro on a frame that accepts
> focus. Something about how the non-focusable frames are causes them
> to get mouse moves immediately after a click. This means that the
> transient map created in mouse-drag-track immediately gets invoked
> with a mouse-movement, which is what triggers the scroll. As
> mentioned earlier in the thread, this is only true if the mouse has
> moved since the last click. That means if you click twice in row,
> only the first click will get a mouse-movement fired after it. If
> you then move the mouse and click again, it'll fire the down-mouse-1
> then the mouse-movement again.
> 
> Perhaps someone who understands the way that mouse tracking works on
> mac would know why a frame that doesn't accept focus behaves
> differently? It's as if the non-focusable window only gets notified
> of a mouse's new position whenever a click happens, so every click
> is as if the click happened and then the mouse moved to that
> position.

Hmm, OK. So normally the first click on a non‐selected NSWindow makes
that NSWindow key (i.e. it selects the frame without registering an
emacs mouse down event), but by enabling no-accept-focus we prevent
the NSWindow becoming key, and the click is then actually registered
as a mouseDown event (therefore causing an Emacs mouse down event).

There’s also a mouseMoved method that says ‘Tell emacs the mouse has
moved.’, but I’m unsure how it does that, or if it’s even relevant. I
don’t think it sends any events unless you have
mouse-autoselect-window set. mouseDragged just calls mouseMoved, so
Emacs must be doing its own mouse move/drag detection elsewhere.

mouseMoved is called every time the mouse pointer moves on an Emacs
frame whether it’s selected or not.

Is it possible a move is being registered because the click was in
frame X, but frame Y is selected? I noticed while testing this that
ns_mouse_position is sometimes (always?) called for multiple frames
when one mouse click has been made.

And, actually, I’m not sure if it’s a bug, but the X and Y coords
returned are for the frame ns-mouse-position is being run from, rather
than from the frame it lists in its output...

*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];


-- 
Alan Third





  reply	other threads:[~2018-05-27 21:24 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22  5:23 bug#31546: 27.0.50; macOS child frames with no mode-line mouse click problem Aaron Jensen
2018-05-22  7:25 ` martin rudalics
2018-05-22  7:33   ` Aaron Jensen
2018-05-22  8:40     ` martin rudalics
2018-05-22 12:51       ` Aaron Jensen
2018-05-22 19:33         ` Alan Third
2018-05-22 19:36           ` Aaron Jensen
2018-05-22 19:44             ` Alan Third
2018-05-22 19:51               ` Aaron Jensen
2018-05-23  6:36                 ` martin rudalics
2018-05-23 11:14                   ` Aaron Jensen
2018-05-23 21:31                     ` Alan Third
2018-05-23 22:21                       ` Aaron Jensen
2018-05-24  7:19                         ` martin rudalics
2018-05-24 10:53                           ` Aaron Jensen
2018-05-24 11:06                             ` Aaron Jensen
2018-05-24 15:28                               ` Eli Zaretskii
2018-05-24 15:58                                 ` Aaron Jensen
2018-05-25  6:34                                   ` martin rudalics
2018-05-26 16:38                                   ` Alan Third
2018-05-26 17:02                                     ` Aaron Jensen
2018-05-26 18:22                                       ` Alan Third
2018-05-26 20:15                                         ` Aaron Jensen
2018-05-27  6:22                                           ` martin rudalics
2018-05-27 15:57                                             ` Eli Zaretskii
2018-05-27 17:13                                               ` Aaron Jensen
2018-05-27 17:38                                                 ` Eli Zaretskii
2018-05-27 17:52                                                   ` Aaron Jensen
2018-05-27 18:52                                                     ` Aaron Jensen
2018-05-27 21:24                                                       ` Alan Third [this message]
2018-05-27 21:53                                                         ` Aaron Jensen
2018-06-02  6:35                                                           ` Aaron Jensen
2018-06-02  8:00                                                             ` Eli Zaretskii
2018-06-02 15:41                                                               ` Aaron Jensen
2018-06-14 16:37                                                                 ` Aaron Jensen
2018-06-14 20:40                                                                   ` Alan Third
2018-06-14 21:21                                                                     ` Aaron Jensen
2018-06-15  7:02                                                                     ` Eli Zaretskii
2018-06-17 11:08                                                                       ` Alan Third
2018-06-17 12:03                                                                         ` Aaron Jensen
2018-05-24 15:27                             ` Eli Zaretskii
2018-05-24  7:19                     ` martin rudalics
2018-05-23  6:36             ` martin rudalics
2018-05-23  6:36           ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180527212429.GA19272@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=31546@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).