We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3190 - Mouse down events with cursor at top point of window are missed
Summary: Mouse down events with cursor at top point of window are missed
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Mac OS X (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-28 19:40 UTC by Joshua Bodine
Modified: 2015-12-29 06:11 UTC (History)
1 user (show)

See Also:


Attachments
Patch which corrects issue (603 bytes, patch)
2015-11-28 19:40 UTC, Joshua Bodine
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Bodine 2015-11-28 19:40:59 UTC
Created attachment 2315 [details]
Patch which corrects issue

This is related to bug 2842, which was resolved by discarding button events which are not within the window content frame. With the current mercurial 2.0 code, on all versions of Mac OS X 10.7 through 10.11, when your cursor is at the very top of the window (easy to do in fullscreen mode), mouse button down events are not registered.

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/#//apple_ref/c/func/NSPointInRect states "Point-in-rectangle functions generally assume that the 'upper' and 'left' edges of a rectangle are inside the rectangle boundaries, while the 'lower' and 'right' edges are outside the boundaries." Since the origin is at the bottom left, this may explain why the NSPointInRect test is failing when the cursor is at the top edge of the screen (I'm not sure why the same issue is not seen on the right edge of the screen, however).

Adding one to the width and height of the rectangle seems to correct the issue, and allows clicks at the top edge of the window to be detected. See attached patch.
Comment 1 Ryan C. Gordon 2015-12-29 06:11:05 UTC
I added a comment to your patch to explain why we were incrementing the rectangle size, and pushed it as https://hg.libsdl.org/SDL/rev/bbe9ef8c2ecb ...thanks!

--ryan.