Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: A NSViewComponent child of DocumentWindow does not receive the mouseMove event anymore. #1494

Open
1 task done
esseci77 opened this issue Dec 12, 2024 · 0 comments

Comments

@esseci77
Copy link

Detailed steps on how to reproduce the bug

Create a DocumentWindow with its main Component. Create a NSViewComponent derived class with mouseMove event overridden, and add this class to the main Component. When you pass the pointer over the NSViewComponent derived object area, the mouseMove callback is never called (but, i.e. the mouseClick works). This happens from 8.0.4. I had to downgrade my app to 8.0.3 to restore the functionality of my window.

After some digging, it seems that the culprit is in the redirectMouseMove() method contained in juce_NSViewComponentPeer_mac.mm:

(...)
if (isWindowAtPoint ([ev window], screenPos))
        {
            if (contains (getMousePos (ev, view).roundToInt(), false))
                sendMouseEvent (ev);
        }
(...)

the sendMouseEvent() is never called. Looking into contains() if found this code:

(...)
NSView* v = [view hitTest: pointInSuperview];

 return trueIfInAChildWindow ? (v != nil)
                                    : (v == view);

the [view hitTest] returned a pointer to the NSView hosted by my NSViewComponent derived class, but since trueIfInAChildWindow is set to false (last argument of contains()), and
since v is not the view of the calling peer, the method returns false.

What is the expected behaviour?

When I move the mouse pointer over a NSViewComponent, the overridden mouseMove() should be called like in any other Component.

Operating systems

macOS

What versions of the operating systems?

Sequoia 15.1.1

Architectures

Arm64/aarch64

Stacktrace

No response

Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

I have not tested against the develop branch

Code of Conduct

  • I agree to follow the Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant