Bug 23103 - Receiving unexpected MouseDown and MouseUp events on custom NSView
Summary: Receiving unexpected MouseDown and MouseUp events on custom NSView
Status: RESOLVED ANSWERED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: Master
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2014-09-17 12:15 UTC by Travis Stutsman
Modified: 2014-12-04 15:05 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample project (10.47 KB, application/zip)
2014-10-03 13:40 UTC, Travis Stutsman
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Travis Stutsman 2014-09-17 12:15:40 UTC
I have a class that inherits NSView and overrides the MouseUp method (MouseDown is also affected by this.)  With this NSView placed in a window I expect to only have this MouseUp method called when the mouse is within the bounds of my NSView, not when the mouse is in another part of the window.  Normally this is the case, but we've discovered a very strange bug.

If I left-click inside my NSView, then move to another part of this window and right-click then immediately left-click (as if to double-click, but right then left) another call is made to MouseUp on my NSView.  The location property of the event is well outside the bounds of my NSView.

I checked an older build of our application (with the runtime bundled) from February 28, 2014 and the same behavior exists, so this is not new.
Comment 1 Prashant manu 2014-09-29 02:42:30 UTC
Could you please provide us the test steps you followed. If possible please
attach a small complete project that demonstrates this behavior.

Also can you please add the logs from the following places?:
On XS IDE Log  Location: XS>Help> Open Log Directory> IDE.log file (with latest
timestamp)
Comment 2 Travis Stutsman 2014-10-03 13:40:07 UTC
Created attachment 8298 [details]
Sample project
Comment 3 Travis Stutsman 2014-10-03 13:47:43 UTC
In the sample application, if you left-click inside the red rectangle (the custom NSView) you get a "MouseDown" message in the console from the MouseDown override on the custom NSView.  This is expected behavior.  If you then proceed to right-click then left-click somewhere outside the red rectangle you will get another "MouseDown" message.  This is unexpected.
Comment 4 Chris Hamons 2014-12-04 15:05:38 UTC
While unfortunate behavior, this actually has nothing to do with Xamarin.Mac. We're exposing the underlying platform behavior perfectly.

I wrote a quick test app that did exactly what yours did:

https://gist.github.com/chamons/3d563be02f37ba7b5ed5

And I got the same behavior. If i had to guess, It probably has to do with the way they do tracking loops. You could hit test inside your mouse down handler to see if it is in your Frame to detect this case.