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

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

bug#28620: Interact directly on Emacs bug#28620: mouse drag event record


From: Robert Weiner
Subject: bug#28620: Interact directly on Emacs bug#28620: mouse drag event records wrong release window
Date: Wed, 4 Oct 2017 13:26:18 -0400

On Wed, Oct 4, 2017 at 12:30 PM, Alan Third <alan@idiocy.org> wrote:
On Tue, Oct 03, 2017 at 08:15:53PM -0400, Robert Weiner wrote:
> On Tue, Oct 3, 2017 at 6:40 PM, Alan Third <alan@idiocy.org> wrote:
> > As far as I can tell ns_mouse_position returns the frame stored in
> > dpyinfo->last_mouse_frame, which is set by EmacsView::mouseDown, however:
> >
> >     If the user clicks a view that isn’t in the key window, by default
> >     the window is brought forward and made key, but the mouse event is
> >     not dispatched.
> >
>
> ​What does "the mouse event is not dispatched mean"?  Does it mean Emacs
> never sees the event?  Maybe Emacs sees only that the window has been
> selected by the window manager and based on that switches to the selected
> window of the frame?

Precisely that.

​So how is it that Emacs processes a drag event when the mouse button is released in the new frame if it never sees the mouseUp (drag release) event?​  If I drag across frames, on mouseUp, the key binding associated with mouseUp (mouse-1 as opposed to down-mouse-1 is run).

​​

> ​The mouse wheel code manages to scroll the proper window that the mouse is
> over, even across overlapping frames where the window the mouse is over is
> in a frame that is partially behind another frame.  And this happens
> without without any click events.  This could be utilized in the click
> event code to get this right somehow.

The mouse wheel code is also handled in mouseDown, the difference is
that macOS always sends the mouse wheel event to the emacs frame under
the mouse pointer, whereas the mouse click event is not sent when the
frame is not already key (i.e. selected).

​Can you show some sample code that would make macOS send the mouse drag release event to the frame under the mouse pointer just as the scroll wheel code does.  I have looked at this mouseUp code in nsterm.m but cannot get it to do this.  I have managed to inject a focus in event to the mouseUp​ function and make its event frame the key frame (selected frame) but its event frame is the wrong one (it always has the frame of the mouseDown event).

​​

​​
AFAICT Emacs does the right thing here, exactly the same thing as
​​
every other macOS app.
​​

​​
​As Eli noted, this does not happen under MS Windows.  I want to have behavior that allows for drags across frames.  The present code does not, so whether it is consistent with Mac UI guidelines, it is not useful for that purpose.  I would like your help in figuring out how to enable such behavior as you seem to understand the macOS event flow well.
​​​
​​

​​
> It looks like the EV_TRAILER macro call at the end of the nsterm.c
​​
> mouseDown function (which is also called by mouseUp) sets the frame used
​​
> for mouse button down, up and scroll wheel events from the variable
​​
> emacsframe.  Somehow the value of emacsframe must be set differently for
​​
> mouse up events than it is for mouse wheel events since they end up with
​​
> different frames for the same mouse positions.
​​
 
​​
There’s nothing fancy here, emacsframe is an instance variable
​​
associated with the EmacsView that macOS sends the mouse event to.

​So show me how and where I could set that variable to the frame of the mouse position at the point of mouseUp​ and I will test it and let people know if it works.

Thanks,

Bob



reply via email to

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